Skip to content

Commit

Permalink
add cache-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Plortinus committed Apr 27, 2017
1 parent 5e84dd1 commit 6b73c7f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 36 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
3. [ElementUI](https://github.com/ElemeFE/element)
4. [Eslint](https://github.com/eslint/eslint)([eslint-config-vue](https://github.com/vuejs/eslint-config-vue) default)
5. [Postcss](https://github.com/postcss/postcss)([autoprefixer](https://github.com/postcss/autoprefixer) default)
5. [Less](http://lesscss.org/)
6. [Less](http://lesscss.org/)
7. [Cache-loader](https://github.com/webpack-contrib/cache-loader)

## Get Started

Expand Down
1 change: 1 addition & 0 deletions template/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
dist/
npm-debug.log
.idea
.cache-loader
7 changes: 4 additions & 3 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"element-ui": "^1.2.8",
"vue": "^2.2.6"
"element-ui": "^1.2.9",
"vue": "^2.3.0"
},
"devDependencies": {
"autoprefixer": "^6.7.7",
"babel-core": "^6.24.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.4.1",
"babel-preset-es2015": "^6.24.1",
"cache-loader": "^1.0.3",
"cross-env": "^4.0.0",
"css-loader": "^0.28.0",
"eslint": "^3.19.0",
Expand All @@ -36,7 +37,7 @@
"style-loader": "^0.16.1",
"url-loader": "^0.5.8",
"vue-loader": "^11.3.4",
"vue-template-compiler": "^2.2.6",
"vue-template-compiler": "^2.3.0",
"webpack": "^2.3.3",
"webpack-dev-server": "^2.4.2"
}
Expand Down
79 changes: 47 additions & 32 deletions template/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,66 +44,81 @@ const config = {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
css: ExtractTextPlugin.extract({
use: 'css-loader',
fallback: 'style-loader'
}),
{{#less}}
less: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader', 'less-loader'],
fallback: 'style-loader'
}),
{{/less}}
postcss: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader'],
fallback: 'style-loader'
})
use: [
'cache-loader',
{
loader: 'vue-loader',
options: {
loaders: {
css: ExtractTextPlugin.extract({
use: ['cache-loader', 'css-loader'],
fallback: 'style-loader'
}),
{{#less}}
less: ExtractTextPlugin.extract({
use: ['cache-loader', 'css-loader', 'postcss-loader', 'less-loader'],
fallback: 'style-loader'
}),
{{/less}}
postcss: ExtractTextPlugin.extract({
use: ['cache-loader', 'css-loader', 'postcss-loader'],
fallback: 'style-loader'
})
}
}
}
}
]
},
{
test: /\.js$/,
use: 'babel-loader',
use: [
'cache-loader',
'babel-loader'
],
include: resolve('src'),
exclude: /node_modules/
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader'],
use: ['cache-loader', 'css-loader', 'postcss-loader'],
fallback: 'style-loader'
})
},
{{#less}}
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader', 'less-loader'],
use: ['cache-loader', 'css-loader', 'postcss-loader', 'less-loader'],
fallback: 'style-loader'
})
},
{{/less}}
{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
root: resolve(__dirname, 'src'),
attrs: ['img:src', 'link:href']
use: [
'cache-loader',
{
loader: 'html-loader',
options: {
root: resolve(__dirname, 'src'),
attrs: ['img:src', 'link:href']
}
}
}]
]
},
{
test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/,
exclude: /favicon\.png$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000
use: [
'cache-loader',
{
loader: 'url-loader',
options: {
limit: 10000
}
}
}]
]
}
]
},
Expand Down

0 comments on commit 6b73c7f

Please sign in to comment.