1.1.0 • Published 7 years ago

css-modules-loader-core v1.1.0

Weekly downloads
565,945
License
ISC
Repository
github
Last release
7 years ago

CSS Module Loader Core

A loader-agnostic CSS Modules implementation, based on PostCSS

Build Status

API

import Core from 'css-modules-loader-core'
let core = new Core()

core.load( sourceString , sourcePath , pathFetcher ) =>  Promise({ injectableSource, exportTokens })

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 statements
  • exportTokens: the mapping from local name to scoped name, as described in the file's :export block

These should map nicely to what your build-tool-specific loader needs to do its job.

new Core(plugins)

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.

import Core from 'css-loader-core'
import autoprefixer from 'autoprefixer'
import colorFunctions from 'postcss-color-function'

// Don't run local-by-default, but use colorFunctions 
// beforehand and autoprefixer afterwards:
let core = new Core([
  colorFunctions, 
  core.plugins.extractImports, 
  core.plugins.scope, 
  autoprefixer("Last 2 Versions")
])
typed-image-modules@parcel-nightly-unofficial/transformer-postcss@ianlucas/parcel-bundlercloud-archive-s3wenke-browserify-csswenke-cssifywenke-cssify-watchify@infinitebrahmanuniverse/nolb-css-m@everything-registry/sub-chunk-1420p149-table@graines-digitales/nice-handsome-button@groooves/typed-css-modules@glas/parcel-bundler@kommunicate/kommunicate-chatbot-plugin@leiyulf/gantt-task-react@lipemat/postcss-boilerplate@hisystems/snowpackfriendly-typed-css-modulesfork-qiniu-typed-less-modulesfis3-hook-css-modulesfis3-preprocessor-css-modules@magicdawn/typed-less-modulesflexscss-parcel-bundler@mizdra/typed-css-modulesgenerator-bootstrap-boilerplate-template@nerdbeere/parcel-bundler@klipstein/parcel-bundler@revenuegrid/style2dts@refactorpro/pixi-virtual-joystick@reshadow/babel@sak1sham/react-toc-highlight@hazyflame/vue-jitsi-meet@gzzhanghao/postcss-modules@jagi/parcel-bundler@jabuco/typed-scss-modules@radist2s/typed-image-moduleshakka-plugin-typed-css-modules@qiniu/typed-less-modules@semcore/babel-plugin-shadow@skbkontur/typed-css-modules@poky85/parcel-bundlerjspm-loader-cssjspm-loader-css-tmpjw-jspm-loader-css@stackstorm/browserify-postcss@bitfirer/vue-qriously@ayc0/parcel-bundlerawesome-typed-css-modules@beisen/typed-css-modulesbabel-plugin-css-modules@fiovex/typed-css-modules@snapview/parcel-bundler@unofficial-parcel-nightly/transformer-postcsslocal-css@volkovasystem/parcel-bundler@abendi/typed-css-modulesnka-gantt-task-reactbrowser-vue-loader@brn/jspm-loader-csschain_digger@unofficial-parcel-nightly/parcel-transformer-postcssmerry-plugin-typed-css-modules@vue-helper/vue-keep-alivemggauharparcel-bundlerparcel-bundler-patchparcel-bundler-slbrowserify-lesspostcss-modules-es@devorso/dcountdownpostcss-color-modreact-lightbox-pack-18supportp147-tablep148-tablepatternplate-transform-cssmodulescss-modules-flow-types-clicss-modulesify-pluscss-modulesifycss-modules-loader-core-synccssloaderifycssify@dishuostec/snowpackresponsis-gantt-task-reactreact-scoped-css-injectorsbt-storybookrollup-plugin-cssrollup-plugin-css-modulerollup-plugin-stylusrollup-plugin-stylus-css-modulesrollup-plugin-stylus-plusrollup-plugin-stylus-to-csssimplessysofe-css-modulesstyl-modulesifystyledbuttonxx@ceoimon/typed-css-modulessticky-scroll-catchts-css-moduletyped-scss-modules-camel-onlytyped-less-modules
1.1.0

7 years ago

1.0.1

8 years ago

1.0.0

9 years ago

1.0.0-beta4

9 years ago

1.0.0-beta3

9 years ago

1.0.0-beta2

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago