Add `to` option to `rollup-plugin-postcss`

Open Beginner friendly
#1,002 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, rollup

Research direction

Start in src/index.js around lines 495-498, where the Rollup PostCSS configuration is created. Review how the output CSS path is available there and how the postcss-url configuration uses the to option. Done means the option is passed so imported fonts can be copied into the build directory, with the reported postcss.config.js scenario working as intended.

Written by the indexing model from the issue text.

Description

CSS

I'm trying to use the postcss-url plugin to copy fonts that are imported by my CSS into the build directory. In order for it to work properly it requires the to option for rollup-plugin-postcss to be set.

I was able to get it working locally by setting to: absMain.replace(EXTENSION, '.css') here:
https://github.com/developit/microbundle/blob/22187fba8a2d404a9f3dc5db357e243cd45e8479/src/index.js#L495-L498

This is the postcss.config.js I'm trying to use:

module.exports = {
  plugins: {
    'postcss-url': {
      url: 'copy',
      basePath: '.',
      assetsPath: '',
      useHash: false,
    },
  },
};

Happy to provide more details, and thanks for your efforts on this great project!

Dominant language
JavaScript
Stars
8.1k
Forks
358
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from developit/microbundle

All issues in developit/microbundle

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.