Name: css-modules-loader-core
Owner: css-modules
Description: A loader-agnostic CSS Modules implementation, based on PostCSS
Created: 2015-05-28 00:11:23.0
Updated: 2018-01-20 16:20:26.0
Pushed: 2017-05-24 16:17:38.0
Size: 100
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A loader-agnostic CSS Modules implementation, based on PostCSS
rt Core from 'css-modules-loader-core'
core = new Core()
Processes the input CSS sourceString
, looking for dependencies such as @import
or :import
. Any localisation will happen by prefixing a sanitised version of sourcePath
When dependencies are found, it will ask the pathFetcher
for each dependency, resolve & inline any imports, and return the following object:
injectableSource
: the final, merged CSS file without @import
or :import
statementsexportTokens
: the mapping from local name to scoped name, as described in the file's :export
blockThese should map nicely to what your build-tool-specific loader needs to do its job.
The default set of plugins is [postcss-modules-local-by-default, postcss-modules-extract-imports, postcss-modules-scope] (i.e. the CSS Modules specification). This can override which PostCSS plugins you wish to execute, e.g.
rt Core from 'css-loader-core'
rt autoprefixer from 'autoprefixer'
rt colorFunctions from 'postcss-color-function'
on't run local-by-default, but use colorFunctions
eforehand and autoprefixer afterwards:
core = new Core([
lorFunctions,
re.plugins.extractImports,
re.plugins.scope,
toprefixer("Last 2 Versions")