Plugins: Can't add css files (plugin-html)

Created on 12 May 2020  路  3Comments  路  Source: rollup/plugins

  • Rollup Plugin Name: plugin-html
  • Rollup Plugin Version: 0.2.0
  • Rollup Version: 2.7.2
  • Operating System (or Browser): Mac OS / Chrome
  • Node Version: 13.11.0

How Do We Reproduce?

  1. Import plugin import html from '@rollup/plugin-html'
  2. Call it as plugin html()

Expected Behavior

Css files added to index.html as liks

Actual Behavior

Empty line inside generated index.html

Thanks.

Most helpful comment

Ok, I get it - the css extraction only work with https://www.npmjs.com/package/rollup-plugin-postcss
And not with https://www.npmjs.com/package/rollup-plugin-less
Anyway, it works now. Please add something to description.

All 3 comments

Thanks for opening an issue. Citing the issue template:

Issues without minimal reproductions will be closed! Please provide one by:

  1. Using the REPL.it plugin reproduction template at https://repl.it/@rollup/rollup-plugin-repro
  2. Provide a minimal repository link (Read https://git.io/fNzHA for instructions).
    These may take more time to triage than the other options.
  3. Using the REPL at https://rollupjs.org/repl/

Please add a reproduction and we'll be happy to triage further.

Yes, link param is not working you can try with:

html({
    fileName: 'index.html',
    publicPath: './', // appended before index.js - <script src="[publicPath]index.js"></script>
    title: 'Wire JS',
    attributes: {
        html: { batsignal: 'on', lang: 'bat' },
        link: { name: 'rel', content: 'stylesheet' },
    },
    meta: [
        { charset: 'utf-8' },
        { name: 'viewport', content: 'minimum-scale=1, initial-scale=1, width=device-width' }
    ],
}),

from here html attributes will be added but not link.

Ok, I get it - the css extraction only work with https://www.npmjs.com/package/rollup-plugin-postcss
And not with https://www.npmjs.com/package/rollup-plugin-less
Anyway, it works now. Please add something to description.

Was this page helpful?
0 / 5 - 0 ratings