-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Option to output CSS instead of JS #185
Comments
we need to refactor this function rollup-plugin-postcss/src/postcss-loader.js Lines 58 to 202 in 77074b6
|
So this patch naively accomplishes my goal in OP: diff --git a/node_modules/rollup-plugin-postcss/dist/index.js b/node_modules/rollup-plugin-postcss/dist/index.js
index 57d9e04..bad0ff4 100644
--- a/node_modules/rollup-plugin-postcss/dist/index.js
+++ b/node_modules/rollup-plugin-postcss/dist/index.js
@@ -307,6 +307,10 @@ var postcssLoader = {
output += `\nimport styleInject from '${styleInjectPath}';\nstyleInject(css${Object.keys(options.inject).length > 0 ? `,${JSON.stringify(options.inject)}` : ''});`;
}
+ if (options.output === 'css') {
+ output = res.css;
+ }
+
return {
code: output,
map: outputMap,
@@ -682,6 +686,8 @@ var index = ((options = {}) => {
/** Inject CSS as `<style>` to `<head>` */
inject: inferOption(options.inject, {}),
+ output: options.output || 'js',
+
/** Extract CSS */
extract: typeof options.extract === 'undefined' ? false : options.extract,
|
nice idea, but I'm thinking to use related #199 |
acc'd to readme, In my case, i'd simply like to transpile the css using post css, so I can import it as a js module using other tools |
May I suggest a alternatively, would you be willing to accept a PR with |
sure, I recently have other things to do, so no time to add features for this project |
👋 Hello! Thanks for publishing this useful package 😄
I'm the author of another CSS plugin for rollup,
rollup-plugin-lit-css
, which is a simple plugin for importing css files into javascript aslit-element
css tagged template literals.I'd like for my users to have the option to pass their CSS through postcss before loading into JS, and have the postcss rollup plugin output a string of CSS without adding js syntax.
Input
app.js
styles.css
rollup.config.js
Expected bundle.js
Actual bundle.js
If this option is already available, I wasn't able to find it in the docs or the source. From a brief tour of the source, it looks like the plugin always exports JS.
Thanks again for publishing this.
The text was updated successfully, but these errors were encountered: