Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit b0621f9

Browse files
committed
pad output
1 parent 2e7a2f1 commit b0621f9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/compiler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
})

lib/compilers/babel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function (raw, cb, compiler, filePath) {
4040
try {
4141
var babel = require('babel-core')
4242
var options = assign({
43+
comments: false,
4344
filename: filePath,
4445
sourceMaps: compiler.options.sourceMap
4546
}, compiler.options.babel || babelOptions)

0 commit comments

Comments
 (0)