postcss-copy icon indicating copy to clipboard operation
postcss-copy copied to clipboard

Assets not copied when using node

Open ericmorand opened this issue 7 years ago • 0 comments

I can't find a way to have postcss-copy works with pure node. Here is my code:

let postcss = require('postcss');

postcss({
    plugins: [
        require('postcss-copy')({
            dest: 'dist',
            basePath: '.'
        })
    ]
}).process('.foo{background-image: url(./foo.png);}').then(function(data) {
    console.warn(data);
});

foo.png is present in '.' and is not copied to 'dist', Plus, postcss returns a warning in its output:

[ Warning {
       type: 'warning',
       text: 'Path must be a string. Received undefined',
       line: 1,
       column: 6,
       node: [Object],
       plugin: 'postcss-copy' } ],

What am I doing wrong?

ericmorand avatar Mar 15 '18 11:03 ericmorand