@@ -209,7 +209,9 @@ module.exports = function (content) {
209
209
}
210
210
211
211
var parts = parse ( content , fileName , this . sourceMap )
212
- // var hasScoped = parts.styles.some(function (s) { return s.scoped })
212
+ // var hasGlobal = parts.styles.some(function (s) { return !!s.global })
213
+ // var scopeId = hasGlobal ? '@GLOBAL' : ('data-v-' + genId(filePath))
214
+ var scopeId = 'data-v-' + genId ( filePath )
213
215
var output = 'var __vue_exports__, __vue_options__\n'
214
216
215
217
// css modules
@@ -304,9 +306,9 @@ module.exports = function (content) {
304
306
}
305
307
306
308
// attach scoped id
307
- // if (hasScoped ) {
308
- // exports += '__vue_options__._scopeId = "' + moduleId + '"\n'
309
- // }
309
+ if ( parts . styles . length ) {
310
+ exports += '__vue_options__._scopeId = "' + scopeId + '"\n'
311
+ }
310
312
311
313
// if (Object.keys(cssModules).length) {
312
314
// // inject style modules as computed properties
@@ -320,11 +322,16 @@ module.exports = function (content) {
320
322
321
323
exports += '__vue_options__.style = __vue_options__.style || {}\n' +
322
324
'__vue_styles__.forEach(function (module) {\n' +
323
- ' for (var name in module) {\n' +
324
- ' __vue_options__.style[name] = module[name]\n' +
325
- ' }\n' +
325
+ ' for (var name in module) {\n' +
326
+ ' __vue_options__.style[name] = module[name]\n' +
327
+ ' }\n' +
326
328
'})\n'
327
329
330
+ // support to register static styles
331
+ exports += 'if (typeof __register_static_styles__ === "function") {\n' +
332
+ ' __register_static_styles__(__vue_options__._scopeId, __vue_styles__)\n' +
333
+ '}\n'
334
+
328
335
if ( ! query . inject ) {
329
336
output += exports
330
337
// hot reload
0 commit comments