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

Commit

Permalink
pad output
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 19, 2016
1 parent 2e7a2f1 commit b0621f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ compiler.compile = function (content, filePath, cb) {
// generate css scope id
var id = 'data-v-' + genId(filePath)
// parse the component into parts
var parts = vueCompiler.parseComponent(content)
var parts = vueCompiler.parseComponent(content, { pad: true })

// check for scoped style nodes
var hasScopedStyle = parts.styles.some(function (style) {
Expand Down Expand Up @@ -175,7 +175,6 @@ compiler.compile = function (content, filePath, cb) {
var inMap = resolvedParts.map
var inMapConsumer = inMap && new sourceMap.SourceMapConsumer(inMap)
var generatedOffset = (output ? output.split(splitRE).length : 0) + 1
var originalOffset = content.slice(0, parts.script.start).split(splitRE).length - 1
script.split(splitRE).forEach(function (line, index) {
var ln = index + 1
var originalLine = inMapConsumer
Expand All @@ -192,7 +191,7 @@ compiler.compile = function (content, filePath, cb) {
column: 0
},
original: {
line: originalLine + originalOffset,
line: originalLine,
column: 0
}
})
Expand Down Expand Up @@ -241,6 +240,7 @@ function processStyle (part, filePath, id, parts) {
var style = getContent(part, filePath)
return compileAsPromise('style', style, part.lang, filePath)
.then(function (res) {
res = res.trim()
return rewriteStyle(id, res, part.scoped, options).then(function (res) {
parts.styles.push(res)
})
Expand Down
1 change: 1 addition & 0 deletions lib/compilers/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = function (raw, cb, compiler, filePath) {
try {
var babel = require('babel-core')
var options = assign({
comments: false,
filename: filePath,
sourceMaps: compiler.options.sourceMap
}, compiler.options.babel || babelOptions)
Expand Down

0 comments on commit b0621f9

Please sign in to comment.