-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Support for [name], [id] in options.filename #6
Comments
@romainberger Till this gets added, can you at least set |
I have a PR #12 that can helps |
Thanks @RemRyahirev, I ended up using a simpler approach with more control under webpack 2. Adding the following to plugins list will process all const path = require('path')
let options
function RTLCSSPlugin(opts) {
options = opts || {}
}
RTLCSSPlugin.prototype.apply = function (compiler) {
compiler.plugin('emit', function (compilation, callback) {
// Explore each chunk (build output):
compilation.chunks.forEach(function (chunk) {
// Explore each asset filename generated by the chunk:
chunk.files.forEach(function (filename) {
// Get the asset source for each file generated by the chunk:
if (path.extname(filename) === '.css') {
let source = compilation.assets[filename].source();
const rtlcss = require('rtlcss')
const rtl = rtlcss.process(compilation.assets[filename].source());
compilation.assets[`${path.basename(filename, '.css')}.rtl.css`] = {
source: function () {
return rtl
},
size: function () {
return rtl.length;
}
}
}
});
});
callback();
});
};
module.exports = RTLCSSPlugin |
@MohammadYounes When do u call |
@sandrina-p It's called with each build once it's added to the plugins list in plugins: [
new RTLCSSPlugin()
] see webpack docs. |
Hi,
When having multiple entry points, and you are required to export multiple bundles such as:
The following will do:
But this won't work in case I wanted to disable or change minification options, for example:
Will produce
[name].rtl.css
instead ofbundle1.rtl.css
,bundle2.rtl.css
andbundle3.rtl.css
.Thanks!
The text was updated successfully, but these errors were encountered: