@@ -9,7 +9,6 @@ var vueCompiler = require('vue-template-compiler')
99var genId = require ( './gen-id' )
1010var normalize = require ( './normalize' )
1111var compilers = require ( './compilers' )
12- var options = require ( './compilers/options' )
1312var rewriteStyle = require ( './style-rewriter' )
1413
1514var hasBabel = true
@@ -29,6 +28,9 @@ var insertCSSPath = normalize.lib('insert-css')
2928var compiler = module . exports = new Emitter ( )
3029compiler . setMaxListeners ( Infinity )
3130
31+ // options
32+ var options = compiler . options = { }
33+
3234// load user config
3335compiler . loadConfig = function ( ) {
3436 var fs = require ( 'fs' )
@@ -96,7 +98,7 @@ compiler.compile = function (content, filePath, cb) {
9698 file : filePath ,
9799 style : style
98100 } )
99- if ( ! process . env . VUEIFY_EXTRACT_CSS ) {
101+ if ( ! options . extractCSS ) {
100102 style = JSON . stringify ( style )
101103 output +=
102104 'var __vueify_style_dispose__ = require("' + insertCSSPath + '").insert(' + style + ')\n'
@@ -134,7 +136,7 @@ compiler.compile = function (content, filePath, cb) {
134136 ' if (!hotAPI.compatible) return\n' +
135137 ' module.hot.accept()\n' +
136138 // remove style tag on dispose
137- ( style && ! process . env . VUEIFY_EXTRACT_CSS
139+ ( style && ! options . extractCSS
138140 ? ' module.hot.dispose(__vueify_style_dispose__)\n'
139141 : '' ) +
140142 ' if (!module.hot.data) {\n' +
@@ -189,7 +191,7 @@ function processStyle (part, filePath, id, parts) {
189191 var style = getContent ( part , filePath )
190192 return compileAsPromise ( 'style' , style , part . lang , filePath )
191193 . then ( function ( res ) {
192- return rewriteStyle ( id , res , part . scoped ) . then ( function ( res ) {
194+ return rewriteStyle ( id , res , part . scoped , options ) . then ( function ( res ) {
193195 parts . styles . push ( res )
194196 } )
195197 } )
0 commit comments