一覧へ戻る
ponday-dev/rollup-plugin-lit-sass(新しいタブで開きます)
主要言語: JavaScript
- star 数
- 3
- watcher 数
- 0
- fork 数
- 4
- issue 数
- 3
- 最終更新
- 2021/08/27
主要言語: JavaScript
Rollup plugin to import '.sass' or '.scss' files as LitElement css templates on JavaScript / TypeScript.
npm install --save-dev @ponday/rollup-plugin-lit-sass
Import and add this plugin to plugins option.
import litSass from '@ponday/rollup-plugin-lit-sass'; export default { entry: 'src/input.js', dest: 'dist/output.js', plugins: [ litSass() ] };
Import sass file on JavaScript.
import { LitElement, html, css} from 'lit-element'; // import as a function that type is (params: { css: typeof require('lit-element').css }) => CSSResult import style from './styles.scss'; export class MyElement extends LitElement { static styles = style({ css }); // other implementations... }
If you want to use TypeScript, you might need type declaraiton file for sass/scss.
An example code for SCSS is following:
declare module "*.scss" { import { css, CSSResult } from 'lit-element'; const scss: (params: { css: typeof css}) => CSSResult; export default scss; }
MIT