Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Rollup.js plugin to compile Stylus and inject CSS Modules

License

NotificationsYou must be signed in to change notification settings

mtojo/rollup-plugin-stylus-css-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

A Rollup.js plugin to compile Stylus and injectCSS Modules.

Installation

$ npm install --save-dev rollup-plugin-stylus-css-modules

Usage

Add the following code to your project'srollup.config.js:

importstylusCssModulesfrom'rollup-plugin-stylus-css-modules';exportdefault{entry:'index.js',plugins:[stylusCssModules({output:'styles.css'})]};

in Stylus

.containerheight100%

in JS

importstylesfrom'./styles.styl';constcontainer=`<divpl-s1">${styles.container}">...</div>`;

Options

  • include,exclude: A minimatch pattern, or an array of minimatch patterns of including ID, or excluding ID (optional).
  • output: Output destination (optional).
    • If you specify asstring, it will be the path to write the generated CSS.
    • If you specify asfunction, call it passing the generated CSS as an argument.
    • If you specify thefalse, CSS will not be output.
    • If this option is not specified, the generated CSS will still be imported (SeeUse with other CSS plugins).
  • sourceMap: Iftrue is specified, source map to be embedded in the output CSS (default istrue).
  • fn: A function invoked with the Stylus renderer (it will be passed touse() function of the Stylus).

Use with external tools

Combination with external tools, such asPostCSS works perfectly.

stylusCssModules({sourceMap:true,output:(css)=>{returnpostcss([// postcss' plugins...]).process(css,{map:true}).then((result)=>{fs.writeFileSync('styles.css',result.css);});}});

Use with other CSS plugins

You can also use the Rollup.js plugin, such asrollup-plugin-postcss,rollup-plugin-css-only, etc.

exportdefault{entry:'index.js',plugins:[stylusCssModules(),postcss()]};

License

MIT

About

A Rollup.js plugin to compile Stylus and inject CSS Modules

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp