egoist / egoist/rollup-plugin-postcss

Keep imports and mark them as external

Open
#346 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
689
Forks
210
PR merge metrics
No merged PRs in 30d

Description

I build a component library and I only want to transform SCSS files to CSS files and keep the `import` statements renamed to the CSS file.
The user of the library is then free to decide which loader he uses and how the CSS is delivered to the browser.
Like [`@rollup/plugin-typescript`](https://www.npmjs.com/package/@rollup/plugin-typescript) does it, it also renames the imports from `*.ts` to `*.js` and generates the transpiled files.

**Input:**
```sh
- src
index.js
index.css
```
```js
import "./index.css";
```

**Output:**
```sh
- dist
index.js
index.css
```
```js
// change only the extension.
import "./foo.css";
```

I made a contrived example using the [`resolveId` hook](https://rollupjs.org/guide/en/#resolveid) with the `external` option:
https://repl.it/@AndyOGo/OldfashionedAnnualCache

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.