Skip to content
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

CSS input, emit raw output to file (no ES parsing) #233

Open
drzraf opened this issue Jun 1, 2023 · 0 comments
Open

CSS input, emit raw output to file (no ES parsing) #233

drzraf opened this issue Jun 1, 2023 · 0 comments

Comments

@drzraf
Copy link

drzraf commented Jun 1, 2023

I'd like to preprocess CSS with rollup + this plugin with no javascript involved (SASS in, CSS out).

{
    input: 'css/index.css',
    output: {
        file: "foo.css",
    },
    plugins: [
      styles({
          include: [/\.css/u],
          use: ['sass'],
          mode: ["emit"],
          minimize: {preset: 'default'},
      })
    ]
}

I tried any possible option to entirely disable output postprocessing:

        sourcemap: false,
        compact: false,
        esModule: false,
        minifyInternalExports: false,
        generatedCode: e => e,
        plugins: []

but I can't get the CSS to be stored because rollup does tryParse :

css/index.css → foo.css...
css/index.css (1:80)
[!] RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
html{-webkit-tex...
*/

I tried to add a dummy plugin to disable this:
```js
        {
	    transform(code, _id) {
		return {ast: code, code, map: null, moduleSideEffects: false};
	    }
        }

but still doesn't keep rollup this.hasEffects(createHasEffectsContext())); from running and triggering an error.

How to achieve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant