rollup-plugin-html-style
Changes in 3.0
- node-sass has been replaced with sass
Changes in 2.0
exported template is no longer TemplateResult but CSSResult. if fore some rease you need to inject style directly into template, use unsafehtml or provide your own tempplate
- all local scss imports must start with relative path! (otherwise resolved to node_module)
- files are resolved from processed.cwd (might enchance when time)
- resolving can be overridden by compilerOptions (@see node-sass)
Example
test.js
;; @ static styles = style { return html`test`; }
test.scss
rollup.config.js
;;; const esmodules = true; const config = input: 'test.js' output: file: 'demo.js' plugins: ;
Options
required
none
optional
esmodules?:boolean default: true
include?:string[] default: ['**/*.scss']
exclude?:string[] default: []
compress?:boolean default: true
env?:string default: esBrowsers|'defaults'
if
option.esmodules
the plugin makes a lookup at caniuse-api for browsers that supportses6-module
, else env isdefault
@BroswerList
template?:(css: string) => string
` import { html } from "lit-element"; export const style = html\`<style></style>\`; export default style;`;
compiler?:({ file, data, ...options }) => Promise<{data}>
BringYourOwnCompiler - atm only
node-sass
is bundled, but provide your own or leave a feature request for other compilers or features?!
; { const resolved = ; nodeSass; };
processor?:({ file, data }) => Promise<string>
BringYourOwnProcessor - this plugin uses
postcss
withpostcss-preset-env
for autoprefix andcssnano
for compress
; { const file data plugins = options; return { ; };};