+upd gitignore ignore css (compiled scss) dir & node_modules + added

multi-compiler webpack.config.js
This commit is contained in:
xdrm-brackets 2018-02-20 00:46:04 +01:00
parent 56b417bd47
commit 2aa73856d3
3 changed files with 129 additions and 1 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
/vendor /vendor
/public_html/css
/node_modules

40
package.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "ptut-vhost",
"description": "PTUT",
"version": "1.0.0",
"author": "xdrm-brackets <xdrm.brackets.dev@gmail.com> SeekDaSky <mascaro.lucas@yahoo.fr G. Fauvet <gfauvet@gmail.com>",
"license": "MIT",
"private": true,
"scripts": {
"build:clean": "rm ./public_html/js/bundle/*.js*;exit 0",
"build:bundle": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"build:dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
"dev": "npm run build:clean; npm run build:dev",
"build": "npm run build:clean; npm run build:bundle",
"scss": "node-sass -r --output-style ./public_html/scss --output ./public_html/css ./public_html/scss"
},
"dependencies": {
"vue": "^2.5.9"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.4",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.5.9",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.5"
}
}

86
webpack.config.js Normal file
View File

@ -0,0 +1,86 @@
var path = require('path')
var webpack = require('webpack')
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractSass = new ExtractTextPlugin({
filename: "[name].css",
disable: process.env.NODE_ENV === "development"
});
var mod_common = {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
}, {
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {} // other vue-loader options go here
}
}, {
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}, {
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: { name: '[name].[ext]?[hash]' }
}
]
};
module.exports = [ {
name: "home",
entry: './webpack/page/home.js',
output: {
path: path.resolve(__dirname, './public_html/js/bundle'),
publicPath: '/js/bundle/',
filename: 'home@[hash].js'
},
module: mod_common,
devtool: '#eval-source-map'
}, {
name: "login",
entry: './webpack/page/login.js',
output: {
path: path.resolve(__dirname, './public_html/js/bundle'),
publicPath: '/js/bundle/',
filename: 'login@[hash].js'
},
module: mod_common,
devtool: '#eval-source-map'
} ]
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}