Skip to content

Instantly share code, notes, and snippets.

@Piterden
Last active July 12, 2016 21:39
Show Gist options
  • Save Piterden/e6b16bda4defd9394a6870cbe89c8149 to your computer and use it in GitHub Desktop.
Save Piterden/e6b16bda4defd9394a6870cbe89c8149 to your computer and use it in GitHub Desktop.
[Laravel 5] Gulp + Webpack + VueJs
var elixir = require('laravel-elixir'),
assetsPath = elixir.config.assetsPath,
publicPath = elixir.config.publicPath;
require('laravel-elixir-webpack-advanced')
require('laravel-elixir-imagemin')
elixir(function (mix) {
mix.styles(
// From:
[
'./node_modules/material-design-lite/material.min.css',
'./node_modules/vue-swipe/dist/vue-swipe.css'
],
// To:
'public/css/common.css')
mix.sass([
'app.scss'
])
mix.scripts('./node_modules/material-design-lite/material.min.js')
mix.webpack('main', require('./webpack.config.js'), {
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
// mix.webpack('admin', require('./webpack.admin.js'), {
// $: 'jquery',
// jQuery: 'jquery',
// 'window.jQuery': 'jquery'
// })
mix.imagemin()
// mix.scripts([
// './node_modules/material-design-lite/material.min.js'
// ])
// mix.babel('./resources/assets/js/admin.js')
})
// require('laravel-elixir-fonts')
/**
* Icon font from SVG generator
*/
// for (var font in fonts) {
// if (fonts.hasOwnProperty(font)) {
// mix.fonts(
// [assetsPath + '/fonts/' + fonts[font] + '/' + fonts[font] + '.svg'],
// publicPath + '/fonts/', {
// font: {
// fontName: fonts[font], // required
// prependUnicode: true // recommended option
// },
// css: {
// fontName: fonts[font],
// // targetPath: '../../' + config.css.sass.folder + '/' + fontName + '.scss',
// fontPath: '../fonts/'
// }
// }
// ) // End mix.fonts
// }
// }
{
"name": "cinemateka",
"version": "1.0.0",
"description": "Cinemateka. Events schedule webapp of 'Seance' magazine.",
"author": "Denis Efremov",
"license": "MIT",
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"dependencies": {
"babel-eslint": "^6.1.2",
"bootstrap-sass": "^3.3.6",
"eslint": "^3.0.1",
"jquery": "^2.2.4",
"laravel-elixir": "^6.0.0-9",
"lodash": "^3.10.1",
"material-design-lite": "^1.1.3",
"moment": "^2.13.0",
"vue": "^1.0.24",
"vue-date-picker": "^1.0.2",
"vue-datepicker": "^1.2.0",
"vue-google-maps": "^0.1.19",
"vue-loader": "^8.5.2",
"vue-mdl": "^0.8.3",
"vue-resource": "^0.7.2",
"vue-router": "^0.7.13",
"vue-swipe": "^0.2.6"
},
"devDependencies": {
"babel-eslint": "^6.1.0",
"eslint": "^3.0.0",
"eslint-plugin-vue": "^0.1.1",
"extract-text-webpack-plugin": "^1.0.1",
"font-loader": "^0.1.2",
"gulp": "^3.9.1",
"gulp-notify": "^2.2.0",
"laravel-elixir": "^6.0.0-2",
"laravel-elixir-fonts": "^0.1.1",
"laravel-elixir-imagemin": "^0.2.3",
"laravel-elixir-webpack-advanced": "^0.3.4",
"node-sass": "^3.7.0",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"stylus": "^0.54.5",
"vue-hot-reload-api": "^1.3.2",
"vue-style-loader": "^1.0.0",
"webpack": "^1.13.1"
}
}
var path = require('path'),
webpack = require('webpack'),
ExtractTextPlugin = require('extract-text-webpack-plugin');
// Export the webpack configuration
module.exports = {
entry: {
vendor: ['jquery'],
admin: ['./admin'],
ajaxCrud: ['./ajax-crud']
},
// Output controls the settings for file generation.
output: {
filename: '[name].js',
path: path.join(__dirname, 'public/js'),
chunkFilename: '[id].js'
},
// Module settings.
module: {
loaders: [{
test: /\.css$/,
loaders: [
ExtractTextPlugin.loader({
extract: true,
omit: 1
}),
'style',
'css'
]
}, {
test: /\.scss$/,
loaders: [
ExtractTextPlugin.loader({
extract: true,
omit: 1
}),
'style',
'css',
'sass'
]
}, {
test: /\.vue$/, // a regex for matching all files that end in `.vue`
loader: 'vue' // loader to use for matched files
}, {
test: /\.js$/,
exclude: /node_modules|admin/,
loader: 'babel'
}]
},
plugins: [
new ExtractTextPlugin('[name].min.css')
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment