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

generate CSS sourcemaps #15

Merged
merged 3 commits into from
Jul 22, 2017
Merged

generate CSS sourcemaps #15

merged 3 commits into from
Jul 22, 2017

Conversation

Rich-Harris
Copy link
Member

Changes the first argument to the css callback to be an object with code and map properties, and a write method for convenience that generates a CSS file with an accompanying sourcemap:

// rollup.config.js
export default {
  entry: 'src/main.js',
  dest: 'public/bundle.js',
  format: 'iife',
  plugins: [
    svelte({
      cascade: false,
      css: css => {
        css.write('public/bundle.css'); // generates bundle.css and bundle.css.map
      }
    })
  ]
};

The write method sets the map.file property correctly and makes the sources in the sourcemap relative to the output file, so it's recommended over handling the code and the map directly (though that's totally possible).

Attempting to use css directly in a string will invoke the toString method, which prints a deprecation warning before returning css.code.

@Rich-Harris
Copy link
Member Author

Fixes #14, but depends on sveltejs/svelte#716

@Rich-Harris Rich-Harris merged commit e4f8218 into master Jul 22, 2017
@Rich-Harris Rich-Harris deleted the css-sourcemaps branch July 22, 2017 03:22
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

Successfully merging this pull request may close these issues.

1 participant