File tree Expand file tree Collapse file tree 8 files changed +61
-27
lines changed Expand file tree Collapse file tree 8 files changed +61
-27
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ exports.cssLoaders = function (options) {
16
16
loader : 'css-loader' ,
17
17
options : {
18
18
minimize : process . env . NODE_ENV === 'production' ,
19
- sourceMap : options . sourceMap
19
+ sourceMap : options . sourceMap ,
20
+ alias : { '../img' : '../static/img' }
20
21
}
21
22
}
22
23
Original file line number Diff line number Diff line change @@ -48,18 +48,24 @@ module.exports = {
48
48
} ,
49
49
{
50
50
test : / \. ( p n g | j p e ? g | g i f | s v g ) ( \? .* ) ? $ / ,
51
- loader : 'url-loader' ,
52
- options : {
53
- limit : 10000 ,
54
- name : utils . assetsPath ( 'img/[name].[hash:7].[ext]' )
51
+ use : {
52
+ loader : 'file-loader' ,
53
+ options : {
54
+ name : '[name].[hash:7].[ext]' ,
55
+ publicPath : '../../' ,
56
+ outputPath : utils . assetsPath ( 'img/' )
57
+ }
55
58
}
56
59
} ,
57
60
{
58
- test : / \. ( w o f f 2 ? | e o t | t t f | o t f ) ( \? .* ) ? $ / ,
59
- loader : 'url-loader' ,
60
- options : {
61
- limit : 10000 ,
62
- name : utils . assetsPath ( 'fonts/[name].[hash:7].[ext]' )
61
+ test : / \. ( w o f f 2 ? | t t f | e o t | s v g ) ( \? v = \d + \. \d + \. \d + ) ? $ / ,
62
+ use : {
63
+ loader : 'file-loader' ,
64
+ options : {
65
+ name : '[name].[hash:7].[ext]' ,
66
+ publicPath : '../../' ,
67
+ outputPath : utils . assetsPath ( 'fonts/' )
68
+ }
63
69
}
64
70
}
65
71
]
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' )
1
2
var utils = require ( './utils' )
2
3
var webpack = require ( 'webpack' )
3
4
var config = require ( '../config' )
4
5
var merge = require ( 'webpack-merge' )
5
6
var baseWebpackConfig = require ( './webpack.base.conf' )
7
+ var CopyWebpackPlugin = require ( 'copy-webpack-plugin' )
6
8
var HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
7
9
var FriendlyErrorsPlugin = require ( 'friendly-errors-webpack-plugin' )
8
10
@@ -30,6 +32,14 @@ module.exports = merge(baseWebpackConfig, {
30
32
template : 'index.html' ,
31
33
inject : true
32
34
} ) ,
33
- new FriendlyErrorsPlugin ( )
35
+ new FriendlyErrorsPlugin ( ) ,
36
+ // copy custom static assets
37
+ new CopyWebpackPlugin ( [
38
+ {
39
+ from : path . resolve ( __dirname , '../static' ) ,
40
+ to : config . build . assetsSubDirectory ,
41
+ ignore : [ '.*' ]
42
+ }
43
+ ] )
34
44
]
35
45
} )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ module.exports = {
7
7
index : path . resolve ( __dirname , '../dist/index.html' ) ,
8
8
assetsRoot : path . resolve ( __dirname , '../dist' ) ,
9
9
assetsSubDirectory : 'static' ,
10
- assetsPublicPath : '/' ,
10
+ assetsPublicPath : '. /' ,
11
11
productionSourceMap : true ,
12
12
// Gzip off by default as many popular static hosts such as
13
13
// Surge or Netlify already gzip all static assets for you.
@@ -26,7 +26,7 @@ module.exports = {
26
26
port : 8080 ,
27
27
autoOpenBrowser : true ,
28
28
assetsSubDirectory : 'static' ,
29
- assetsPublicPath : '/ ' ,
29
+ assetsPublicPath : '' ,
30
30
proxyTable : { } ,
31
31
// CSS Sourcemaps off by default because relative paths are "buggy"
32
32
// with this option, according to the CSS-Loader README
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ exports.cssLoaders = function (options) {
16
16
loader : 'css-loader' ,
17
17
options : {
18
18
minimize : process . env . NODE_ENV === 'production' ,
19
- sourceMap : options . sourceMap
19
+ sourceMap : options . sourceMap ,
20
+ alias : { '../img' : '../static/img' }
20
21
}
21
22
}
22
23
@@ -50,7 +51,7 @@ exports.cssLoaders = function (options) {
50
51
postcss : generateLoaders ( ) ,
51
52
less : generateLoaders ( 'less' ) ,
52
53
sass : generateLoaders ( 'sass' , { indentedSyntax : true } ) ,
53
- scss : generateLoaders ( 'sass' ) ,
54
+ scss : generateLoaders ( 'sass' ) ,
54
55
stylus : generateLoaders ( 'stylus' ) ,
55
56
styl : generateLoaders ( 'stylus' )
56
57
}
Original file line number Diff line number Diff line change @@ -48,18 +48,24 @@ module.exports = {
48
48
} ,
49
49
{
50
50
test : / \. ( p n g | j p e ? g | g i f | s v g ) ( \? .* ) ? $ / ,
51
- loader : 'url-loader' ,
52
- options : {
53
- limit : 10000 ,
54
- name : utils . assetsPath ( 'img/[name].[hash:7].[ext]' )
51
+ use : {
52
+ loader : 'file-loader' ,
53
+ options : {
54
+ name : '[name].[hash:7].[ext]' ,
55
+ publicPath : '../../' ,
56
+ outputPath : utils . assetsPath ( 'img/' )
57
+ }
55
58
}
56
59
} ,
57
60
{
58
- test : / \. ( w o f f 2 ? | e o t | t t f | o t f ) ( \? .* ) ? $ / ,
59
- loader : 'url-loader' ,
60
- options : {
61
- limit : 10000 ,
62
- name : utils . assetsPath ( 'fonts/[name].[hash:7].[ext]' )
61
+ test : / \. ( w o f f 2 ? | t t f | e o t | s v g ) ( \? v = \d + \. \d + \. \d + ) ? $ / ,
62
+ use : {
63
+ loader : 'file-loader' ,
64
+ options : {
65
+ name : '[name].[hash:7].[ext]' ,
66
+ publicPath : '../../' ,
67
+ outputPath : utils . assetsPath ( 'fonts/' )
68
+ }
63
69
}
64
70
}
65
71
]
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' )
1
2
var utils = require ( './utils' )
2
3
var webpack = require ( 'webpack' )
3
4
var config = require ( '../config' )
4
5
var merge = require ( 'webpack-merge' )
5
6
var baseWebpackConfig = require ( './webpack.base.conf' )
7
+ var CopyWebpackPlugin = require ( 'copy-webpack-plugin' )
6
8
var HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
7
9
var FriendlyErrorsPlugin = require ( 'friendly-errors-webpack-plugin' )
8
10
@@ -30,6 +32,14 @@ module.exports = merge(baseWebpackConfig, {
30
32
template : 'index.html' ,
31
33
inject : true
32
34
} ) ,
33
- new FriendlyErrorsPlugin ( )
35
+ new FriendlyErrorsPlugin ( ) ,
36
+ // copy custom static assets
37
+ new CopyWebpackPlugin ( [
38
+ {
39
+ from : path . resolve ( __dirname , '../static' ) ,
40
+ to : config . build . assetsSubDirectory ,
41
+ ignore : [ '.*' ]
42
+ }
43
+ ] )
34
44
]
35
45
} )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ module.exports = {
7
7
index : path . resolve ( __dirname , '../dist/index.html' ) ,
8
8
assetsRoot : path . resolve ( __dirname , '../dist' ) ,
9
9
assetsSubDirectory : 'static' ,
10
- assetsPublicPath : '/' ,
10
+ assetsPublicPath : '. /' ,
11
11
productionSourceMap : true ,
12
12
// Gzip off by default as many popular static hosts such as
13
13
// Surge or Netlify already gzip all static assets for you.
@@ -26,7 +26,7 @@ module.exports = {
26
26
port : 8080 ,
27
27
autoOpenBrowser : true ,
28
28
assetsSubDirectory : 'static' ,
29
- assetsPublicPath : '/ ' ,
29
+ assetsPublicPath : '' ,
30
30
proxyTable : { } ,
31
31
// CSS Sourcemaps off by default because relative paths are "buggy"
32
32
// with this option, according to the CSS-Loader README
You can’t perform that action at this time.
0 commit comments