Skip to content

Commit

Permalink
upgrade webpack=>2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leftstick committed Jan 27, 2017
1 parent 0d85c68 commit 7a66de3
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 47 deletions.
10 changes: 7 additions & 3 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ class gen extends Generator {
require('date-util');
this.answers = answers;
this.answers.date = new Date().format('mmm d, yyyy');
this.obj = {answers: this.answers};
this.obj = {
answers: this.answers
};
});
}

Expand All @@ -102,13 +104,13 @@ class gen extends Generator {
this.fs.copyTpl(this.templatePath('js'), this.destinationPath('js'), this.obj, {
interpolate: /<%=([\s\S]+?)%>/g
});
this.fs.copy(this.templatePath('css', '*'), this.destinationPath('css'));
this.fs.copy(this.templatePath('eslintrc'), this.destinationPath('.eslintrc'));
this.fs.copy(this.templatePath('esformatter'), this.destinationPath('.esformatter'));
this.fs.copy(this.templatePath('gitignore'), this.destinationPath('.gitignore'));
this.fs.copyTpl(this.templatePath('index.html_vm'), this.destinationPath('index.html_vm'), this.obj);

this.fs.copyTpl(this.templatePath('package.json_vm'), this.destinationPath('package.json'), this.obj);
this.fs.copy(this.templatePath('postcss.config.js'), this.destinationPath('postcss.config.js'));

this.fs.copyTpl(this.templatePath('webpack.config.js'),
this.destinationPath('webpack.config.js'), this.obj);
Expand All @@ -118,7 +120,9 @@ class gen extends Generator {
}

install() {
this.npmInstall(null, {registry: this.answers.registry});
this.npmInstall(null, {
registry: this.answers.registry
});
}

end() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* logo */
#logo-wrap {
margin: 55px 0 20px 0;
text-align: center;
}

#logo-wrap img{
Expand Down
18 changes: 9 additions & 9 deletions generators/app/templates/package.json_vm
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"description": "<%= answers.description %>",
"scripts": {
"release": "rm -rf build; webpack --config webpack.config.prod.js",
"start": "webpack-dev-server --content-base build/ --history-api-fallback --hot --inline --host 0.0.0.0"
"start": "webpack-dev-server --hot --inline --host 0.0.0.0"
},
"files": [
"css",
"etc",
"img",
"js",
"index.html",
"postcss.config.js",
"webpack.config.js",
"webpack.config.prod.js"
],
Expand All @@ -23,18 +23,18 @@
"splash-screen": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^6.6.1",
"babel-core": "^6.21.0",
"autoprefixer": "^6.7.0",
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.18.0",
"babel-plugin-angularjs-annotate": "^0.7.0",
"babel-preset-es2015": "^6.22.0",
"css-loader": "^0.26.1",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.26.0",
"ng-annotate-loader": "^0.2.0",
"postcss-loader": "^1.2.1",
"postcss-loader": "^1.2.2",
"html-loader": "^0.4.4",
"style-loader": "^0.13.1",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2"
"webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0"
}
}
9 changes: 9 additions & 0 deletions generators/app/templates/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const autoprefixer = require('autoprefixer');

module.exports = {
plugins: [
autoprefixer({
browsers: ['last 5 versions']
})
]
};
49 changes: 33 additions & 16 deletions generators/app/templates/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
Expand All @@ -13,45 +12,63 @@ module.exports = {
chunkFilename: '[id].bundle.js',
publicPath: '/'
},
debug: true,
devtool: 'source-map',
devServer: {
contentBase: path.resolve(__dirname, 'build'),
historyApiFallback: true
},
module: {
loaders: [
rules: [
{
test: /splash\.min\.css$/,
loader: 'style/useable'
use: [
'style-loader/useable'
]
},
{
test: /(?!min)\.css$/,
loader: 'style!css!postcss!'
use: [
'style-loader',
'css-loader',
'postcss-loader'
]
},
{
test: /\.(js|co)$/,
loader: 'ng-annotate!babel?{"presets":["es2015"]}',
use: [
{
loader: 'babel-loader',
options: {
presets: [['es2015', {
modules: false
}]],
plugins: ['angularjs-annotate']
}
}
],
exclude: /(node_modules)/
},
{
test: /\.(eot|svg|ttf|woff|woff2|png)\w*/,
loader: 'file'
use: [
'file-loader'
]
},
{
test: /\.html$/,
loader: 'html'
use: [
'html-loader'
]
}
]
},
postcss: function() {
return [
autoprefixer({browsers: ['last 5 versions']})
];
},
resolve: {
root: [
modules: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname),
path.resolve(__dirname, 'js/')
path.resolve(__dirname, 'js')
],
extensions: [
'',
'.js',
'.co'
]
Expand Down
46 changes: 29 additions & 17 deletions generators/app/templates/webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
Expand All @@ -14,44 +13,57 @@ module.exports = {
publicPath: '/'
},
module: {
loaders: [
rules: [
{
test: /splash\.min\.css$/,
loader: 'style/useable'
use: [
'style-loader/useable'
]
},
{
test: /(?!min)\.css$/,
loader: 'style!css!postcss!'
use: [
'style-loader',
'css-loader',
'postcss-loader'
]
},
{
test: /\.(js|co)$/,
loader: 'ng-annotate!babel?{"presets":["es2015"]}',
use: [
{
loader: 'babel-loader',
options: {
presets: [['es2015', {
modules: false
}]],
plugins: ['angularjs-annotate']
}
}
],
exclude: /(node_modules)/
},
{
test: /\.(eot|svg|ttf|woff|woff2|png)\w*/,
loader: 'file'
use: [
'file-loader'
]
},
{
test: /\.html$/,
loader: 'html'
use: [
'html-loader'
]
}
]
},
postcss: function() {
return [
autoprefixer({
browsers: ['last 5 versions']
})
];
},
resolve: {
root: [
modules: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname),
path.resolve(__dirname, 'js/')
path.resolve(__dirname, 'js')
],
extensions: [
'',
'.js',
'.co'
]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-es6-angular",
"version": "5.0.1",
"version": "5.0.2",
"description": "generator-es6-angular",
"repository": {
"type": "git",
Expand All @@ -27,6 +27,6 @@
"dependencies": {
"date-util": "^1.2.1",
"lodash": "^4.17.4",
"yeoman-generator": "^1.0.1"
"yeoman-generator": "^1.1.0"
}
}

0 comments on commit 7a66de3

Please sign in to comment.