arpadHegedus / postcss-node-sass

A PostCSS plugin to parse styles with node-sass
MIT License
23 stars 16 forks source link

the 'data' is overwritten #10

Open yanhaijing opened 5 years ago

yanhaijing commented 5 years ago

I want to inject some variables into all scss file, but i found the 'data' is overwritten

opt = Object.assign({
        indentWidth: 4,
        omitSourceMapUrl: true,
        outputStyle: 'expanded',
        sourceMap: true,
        sourceMapContents: true
    }, opt, {
        data: css.css,
        file: result.opts.from,
        outFile: result.opts.to
    })

Instead of overwritten, try concat

opt = Object.assign({
        indentWidth: 4,
        omitSourceMapUrl: true,
        outputStyle: 'expanded',
        sourceMap: true,
        sourceMapContents: true
    }, opt, {
        data: [opt.data, css.css].join('\n'),
        file: result.opts.from,
        outFile: result.opts.to
    })
yanhaijing commented 5 years ago

???