import merge from 'merge-source-map'
-import path from 'path'
import { RawSourceMap } from 'source-map'
import { SFCStyleCompileOptions } from './compileStyle'
try {
const result = nodeSass.renderSync(finalOptions)
- // sass output path is position path
const dependencies = result.stats.includedFiles
if (map) {
return {
)
if (error) return { code: '', errors: [error], dependencies: [] }
- // less output path is relative path
- const dependencies = getAbsolutePaths(
- result.imports,
- path.dirname(options.filename)
- )
+ const dependencies = result.imports
if (map) {
return {
code: result.css.toString(),
if (map) ref.set('sourcemap', { inline: false, comment: false })
const result = ref.render()
- // stylus output path is relative path
- const dependencies = getAbsolutePaths(
- ref.deps(),
- path.dirname(options.filename)
- )
+ const dependencies = ref.deps()
if (map) {
return {
code: result,
styl,
stylus: styl
}
-
-function getAbsolutePaths(relativePaths: string[], dirname: string): string[] {
- return relativePaths.map(relativePath => path.join(dirname, relativePath))
-}