@@ -63,7 +63,7 @@ compiler.compile = function (content, filePath, cb) {
63
63
// generate css scope id
64
64
var id = 'data-v-' + genId ( filePath )
65
65
// parse the component into parts
66
- var parts = vueCompiler . parseComponent ( content )
66
+ var parts = vueCompiler . parseComponent ( content , { pad : true } )
67
67
68
68
// check for scoped style nodes
69
69
var hasScopedStyle = parts . styles . some ( function ( style ) {
@@ -175,7 +175,6 @@ compiler.compile = function (content, filePath, cb) {
175
175
var inMap = resolvedParts . map
176
176
var inMapConsumer = inMap && new sourceMap . SourceMapConsumer ( inMap )
177
177
var generatedOffset = ( output ? output . split ( splitRE ) . length : 0 ) + 1
178
- var originalOffset = content . slice ( 0 , parts . script . start ) . split ( splitRE ) . length - 1
179
178
script . split ( splitRE ) . forEach ( function ( line , index ) {
180
179
var ln = index + 1
181
180
var originalLine = inMapConsumer
@@ -192,7 +191,7 @@ compiler.compile = function (content, filePath, cb) {
192
191
column : 0
193
192
} ,
194
193
original : {
195
- line : originalLine + originalOffset ,
194
+ line : originalLine ,
196
195
column : 0
197
196
}
198
197
} )
@@ -241,6 +240,7 @@ function processStyle (part, filePath, id, parts) {
241
240
var style = getContent ( part , filePath )
242
241
return compileAsPromise ( 'style' , style , part . lang , filePath )
243
242
. then ( function ( res ) {
243
+ res = res . trim ( )
244
244
return rewriteStyle ( id , res , part . scoped , options ) . then ( function ( res ) {
245
245
parts . styles . push ( res )
246
246
} )
0 commit comments