@@ -63,7 +63,7 @@ compiler.compile = function (content, filePath, cb) {
6363 // generate css scope id
6464 var id = 'data-v-' + genId ( filePath )
6565 // parse the component into parts
66- var parts = vueCompiler . parseComponent ( content )
66+ var parts = vueCompiler . parseComponent ( content , { pad : true } )
6767
6868 // check for scoped style nodes
6969 var hasScopedStyle = parts . styles . some ( function ( style ) {
@@ -175,7 +175,6 @@ compiler.compile = function (content, filePath, cb) {
175175 var inMap = resolvedParts . map
176176 var inMapConsumer = inMap && new sourceMap . SourceMapConsumer ( inMap )
177177 var generatedOffset = ( output ? output . split ( splitRE ) . length : 0 ) + 1
178- var originalOffset = content . slice ( 0 , parts . script . start ) . split ( splitRE ) . length - 1
179178 script . split ( splitRE ) . forEach ( function ( line , index ) {
180179 var ln = index + 1
181180 var originalLine = inMapConsumer
@@ -192,7 +191,7 @@ compiler.compile = function (content, filePath, cb) {
192191 column : 0
193192 } ,
194193 original : {
195- line : originalLine + originalOffset ,
194+ line : originalLine ,
196195 column : 0
197196 }
198197 } )
@@ -241,6 +240,7 @@ function processStyle (part, filePath, id, parts) {
241240 var style = getContent ( part , filePath )
242241 return compileAsPromise ( 'style' , style , part . lang , filePath )
243242 . then ( function ( res ) {
243+ res = res . trim ( )
244244 return rewriteStyle ( id , res , part . scoped , options ) . then ( function ( res ) {
245245 parts . styles . push ( res )
246246 } )
0 commit comments