-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Optional StyleInject — just the compiled CSS as an output #54
Comments
…ix while waiting for egoist/rollup-plugin-postcss#54) This is required to make the inline-svg plugin work.
cc @lmihaidaniel maybe add |
that will do, was next on my to-do list |
Check out inject option in |
Hi @egoist and @lmihaidaniel, I tried to add the This is the configuration that I'm using: //...
plugins: [
postcss({
inject: false,
plugins: [
inlineSvg,
autoprefixer({browsers: 'last 2 versions'}),
],
}), and this is the output code generated: function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
if (!css) { return }
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
var css = "[...]";
__$$styleInject(css); Ideally, I'd just like to get rid of the Would that be possible? EDIT: looking at the source code, it looks like the |
Fixed in |
It works now — thank you! |
Could you please update README to mention this behavior? |
@nikolay-borzov what needs To be updated? it's already in the options section. |
Right, but it doesn't say that setting |
It will always export a variable with the CSS string unless |
Thanks! |
Is there a way to get hold of the generated styles when |
I'm trying to use this plugin to compile the styles of a Web Component.
These are the relevant bits of code in the JS entry point:
As you can see, I just need the imported
styles
to be the compiled CSS string, but so far I haven't managed to get rid of the call to the__$styleInject
function.Is there a way to obtain, as an output, just the processed CSS string?
The text was updated successfully, but these errors were encountered: