css-modules-loader-core

WebJar for css-modules-loader-core

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

css-modules-loader-core
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

css-modules-loader-core
WebJar for css-modules-loader-core
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/css-modules/css-modules-loader-core

Download css-modules-loader-core

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/css-modules-loader-core/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>css-modules-loader-core</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/css-modules-loader-core/
implementation 'org.webjars.npm:css-modules-loader-core:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/css-modules-loader-core/
implementation ("org.webjars.npm:css-modules-loader-core:1.1.0")
'org.webjars.npm:css-modules-loader-core:jar:1.1.0'
<dependency org="org.webjars.npm" name="css-modules-loader-core" rev="1.1.0">
  <artifact name="css-modules-loader-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='css-modules-loader-core', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "css-modules-loader-core" % "1.1.0"
[org.webjars.npm/css-modules-loader-core "1.1.0"]

Dependencies

compile (6)

Group / Artifact Type Version
org.webjars.npm : postcss-modules-values jar [1.3.0]
org.webjars.npm : postcss-modules-local-by-default jar [1.2.0]
org.webjars.npm : postcss-modules-scope jar [1.1.0]
org.webjars.npm : icss-replace-symbols jar [1.1.0]
org.webjars.npm : postcss-modules-extract-imports jar [1.1.0]
org.webjars.npm : postcss jar [6.0.1]

Project Modules

There are no modules declared in this project.

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")
])
org.webjars.npm

Versions

Version
1.1.0
1.0.0