Releases: Ser-Gen/postcss-data-packer
Releases · Ser-Gen/postcss-data-packer
1.2.3
1.2.2
- function in
annotation
of source map options will be working properly
Value of annotation must be string or boolean — https://github.com/postcss/postcss/blob/master/docs/source-maps.md#options
In previous release you will get only default value of annotation: opts.to + '.map'
.
In this release function in annotation will execute in advance to get proper reslut.
1.2.1
Options of function in dest.map.annotation
have become richer.
For example, now you can set filenames only in opts of postcss.process()
:
var fs = require('fs');
var path = require('path');
require('postcss')([
require('postcss-data-packer')({
dest: {
path: function (opts) {
return path.join(path.dirname(opts.to), path.basename(opts.to, '.css') + '.data.css');
},
map: {
inline: false,
annotation: function (dataOpts, opts) {
return path.join(path.dirname(opts.map.annotation), path.basename(dataOpts.to) +'.map');
}
}
}
})
])
.process(fs.readFileSync('_main.css'), {
from: '_main.css',
to: 'css/main.css',
map: {
inline: false,
annotation: 'css/maps/main.css.map'
}
})
.then(function (result) {
fs.writeFileSync(result.opts.to, result.css);
if ( result.map ) {
fs.writeFileSync(result.opts.map.annotation, result.map);
};
});
After executing you will get:
[cwd]
├── css
│ ├── maps
│ | ├── main.css.map
│ | └── main.data.css.map
│ ├── main.css
│ └── main.data.css
└── _main.css