Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  bump template version
  fix bug with #1202
  Make CSS sourcemaps on by default
  Ensure page reloads in history mode serve index.html
  use old sourcemap option
  Add postcss-url to match postcss-import (#1115)
  Change engine>node{4 => 6} for template (#1206)
  Fix static file serving for publicPath != `/` (fix#1176) (#1180)
  Load, render template version using helper (#1202)
  fix typo in a comment (#1183)
  fix #1140
  • Loading branch information
LinusBorg committed Dec 31, 2017
2 parents 2b90ae2 + 52003cd commit e7005e1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 15 deletions.
9 changes: 8 additions & 1 deletion meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@ const {
runLintFix,
printMessage,
} = require('./utils')
const pkg = require('./package.json')

const templateVersion = pkg.version

module.exports = {
helpers: {
if_or: function(v1, v2, options) {
if_or(v1, v2, options) {
if (v1 || v2) {
return options.fn(this)
}

return options.inverse(this)
},
template_version() {
return templateVersion
},
},

prompts: {
name: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-cli-template-webpack",
"version": "1.2.7",
"version": "1.2.8",
"license": "MIT",
"description": "A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion template/.postcssrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

module.exports = {
"plugins": {
// to edit target browsers: use "browserslist" field in package.json
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
2 changes: 1 addition & 1 deletion template/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = {
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
Expand Down
17 changes: 16 additions & 1 deletion template/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
Expand All @@ -21,8 +23,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: true,
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
Expand Down Expand Up @@ -50,6 +57,14 @@ const devWebpackConfig = merge(baseWebpackConfig, {
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})

Expand Down
2 changes: 1 addition & 1 deletion template/build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const webpackConfig = merge(baseWebpackConfig, {
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vender modules does not change
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
Expand Down
11 changes: 3 additions & 8 deletions template/config/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
// Template version: 1.2.7
// Template version: {{ template_version }}
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')
Expand Down Expand Up @@ -34,19 +34,14 @@ module.exports = {
*/

// https://webpack.js.org/configuration/devtool/#development
devtool: 'eval-source-map',
devtool: 'cheap-module-eval-source-map',

// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,

// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false,
cssSourceMap: true,
},

build: {
Expand Down
3 changes: 2 additions & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"node-notifier": "^5.1.2",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"optimize-css-assets-webpack-plugin": "^3.2.0",
Expand All @@ -118,7 +119,7 @@
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 4.0.0",
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
Expand Down

0 comments on commit e7005e1

Please sign in to comment.