@@ -2,10 +2,8 @@ require('shelljs/global')
22
33const path = require ( 'path' )
44const config = require ( './config' )
5- const cheerio = require ( 'cheerio' )
65const ora = require ( 'ora' )
76let webpack = require ( 'webpack' )
8- const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
97const env = process . env . ENV || 'dev'
108const packageConfig = require ( '../package.json' )
119
@@ -21,84 +19,6 @@ exports.assetsPath = function(_path) {
2119 return path . posix . join ( assetsSubDirectory , _path )
2220}
2321
24- exports . cssLoaders = function ( options ) {
25- options = options || { }
26-
27- let cssLoader = {
28- loader : 'css-loader' ,
29- options : {
30- sourceMap : options . sourceMap
31- }
32- }
33-
34- const postcssLoader = {
35- loader : 'postcss-loader' ,
36- options : {
37- sourceMap : options . sourceMap
38- }
39- }
40-
41- // generate loader string to be used with extract text plugin
42- // generate loader string to be used with extract text plugin
43- function generateLoaders ( loader , loaderOptions ) {
44- const loaders = options . usePostCSS
45- ? [ cssLoader , postcssLoader ]
46- : [ cssLoader ]
47-
48- if ( loader ) {
49- loaders . push ( {
50- loader : loader + '-loader' ,
51- options : Object . assign ( { } , loaderOptions , {
52- sourceMap : options . sourceMap
53- } )
54- } )
55- }
56-
57- // Extract CSS when that option is specified
58- // (which is the case during production build)
59- if ( options . extract ) {
60- return ExtractTextPlugin . extract ( {
61- use : loaders ,
62- fallback : 'vue-style-loader'
63- } )
64- } else {
65- return [ 'vue-style-loader' ] . concat ( loaders )
66- }
67- }
68-
69- // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
70- return {
71- css : generateLoaders ( ) ,
72- postcss : generateLoaders ( ) ,
73- less : generateLoaders ( 'less' ) ,
74- sass : generateLoaders ( 'sass' , { indentedSyntax : true } ) ,
75- scss : generateLoaders ( 'sass' , {
76- includePaths : [
77- path . join ( __dirname , '../src/style' ) ,
78- path . join ( __dirname , '../node_modules' )
79- ]
80- } ) ,
81- stylus : generateLoaders ( 'stylus' ) ,
82- styl : generateLoaders ( 'stylus' )
83- }
84- }
85-
86- // Generate loaders for standalone style files (outside of .vue)
87- exports . styleLoaders = function ( options ) {
88- const output = [ ]
89- const loaders = exports . cssLoaders ( options )
90-
91- for ( const extension in loaders ) {
92- const loader = loaders [ extension ]
93- output . push ( {
94- test : new RegExp ( '\\.' + extension + '$' ) ,
95- use : loader
96- } )
97- }
98-
99- return output
100- }
101-
10222exports . getDllNames = function ( ) {
10323 let map = { }
10424 ls ( path . join ( assetsRoot , assetsSubDirectory , '**/*.dll.*.js' ) ) . forEach (
@@ -116,23 +36,6 @@ exports.getDllNames = function() {
11636 return map
11737}
11838
119- // 去掉 html 标签
120- exports . strip = function ( html , tags ) {
121- let $ = cheerio . load ( html , { decodeEntities : false } )
122- if ( ! tags || tags . length === 0 ) {
123- return html
124- }
125-
126- tags = ! Array . isArray ( tags ) ? [ tags ] : tags
127- let len = tags . length
128-
129- while ( len -- ) {
130- $ ( tags [ len ] ) . remove ( )
131- }
132-
133- return $ ( 'body' ) . html ( )
134- }
135-
13639exports . createNotifierCallback = ( ) => {
13740 const notifier = require ( 'node-notifier' )
13841
0 commit comments