Crunch / postcss-less

MIT License
35 stars 9 forks source link

less import inline #2

Open a-ursino opened 8 years ago

a-ursino commented 8 years ago

Hi

is import inline supported?

it seems that with "postcss-less-engine":"^0.6.1" and "less": "^2.7.1" it's ignored

thanks so much

a-ursino commented 8 years ago

this is how i use the plugin at the `moment

const postCssPlugins = [];
postCssPlugins.push(stylelint({ configFile: path.join(process.cwd(), '.stylelintrc.json') }));
postCssPlugins.push(less({ strictMath: true, paths: lessPath }));
postCssPlugins.push(reporter({ clearMessages: true }));
postCssPlugins.push(autoprefixer({ browsers: AUTOPREFIXER_BROWSERS }));
// transform image url for CDN
postCssPlugins.push(url({
    url(imageurl) {
        if (minify) {
            if (!imageurl.startsWith('http')) {
                return imageurl.startsWith('/') ? `${cdnDomain}/${projectName}${imageurl}` : imageurl;
            }
        }
        return imageurl;
    },
}));

// CAN I USE
postCssPlugins.push(doiuse({
    browsers: ['ie >= 9', '> 1%'],
    ignore: [], // an optional array of features to ignore 'rem'
    ignoreFiles: [path.join(process.cwd(), 'node_modules', '/**/*.less')], // an optional array of file globs to match against original source file path, to ignore
    onFeatureUsage(usageInfo) {
        logger.warn('CAN I USE', usageInfo.message);
    },
}));
// postcss(plugins)  list of PostCSS plugins to be included as processors.
const cssProcessor = postcss(postCssPlugins);

// process less file
const processedCssObject = await cssProcessor.process(lessInput, { parser: less.parser, from: filepath });

maybe i do something wrong?

matthew-dean commented 8 years ago

All Less features should be supported. But note that postcss-less needs to be the first PostCSS plugin used in your plugin stack.