Skip to content
Nathan Reid edited this page Jul 29, 2016 · 18 revisions

Package Options are set by creating a cssModules section in package.json. Here is a sample package.json:

{
  "name": "my-app-name",
  "version": "1.0.0",
  "dependencies": {
    "meteor-node-stubs": "^0.2.3"
  },
  "cssModules": {
    "option1": "setting",
    "option2": true,
    "option3": [ "a", "b" ]
  }  
}

Here is a list of the supported settings:

Property Default Value Available Values Description
cssClassNamingConvention { replacements: [] } See cssClassNamingConvention.
extensions ['mss', 'm.css'] An array of file extensions Only the extensions included in this setting will be processed by the plugin.
enableSassCompilation ['scss', 'sass'] An array of file extensions, or false Only the extensions included in this setting will undergo Sass compilation. The extensions must also be included in the extensions property.
enableStylusCompilation ['styl', 'm.styl'] An array of file extensions, or false Only the extensions included in this setting will undergo Stylus compilation. The extensions must also be included in the extensions property.
ignorePaths [] An array of regular expression patterns (as strings) Files that match any of these patterns will be excluded from processing, for example use the following to exclude the entire node_modules folder: [ 'node_modules' ].
parser undefined The name of your PostCSS parser, if any. The value of this option will be require()d and passed to PostCSS. For more details, see [[Sugarss and other PostCSS parsers
passthroughPaths [] An array of regular expression patterns (as strings) Files that match any of these patterns will be passed through unchanged, for example use the following to exclude bootstrap from processing anywhere in the project: [ 'bootstrap.css' ].
specificArchitecture 'web' Any valid archMatching string, or false Allows filtering the plugin to run on a specific architecture. By default the plugin runs on 'web' (client-side) only; to enable server-side processing as well, set the value to false. To enable server-side and disable client-side processing, set the value to 'os'.

cssClassNamingConvention

Property Default Value Available Values Description
replacements [] An array of regular expression patterns (as strings) OR an array of regex replacement arrays of the form [pattern, regexOptions, replacementText = ''] ` Text that matches these replacements will be replaced by the replacement text (or removed if there is no replacement text specified).
Example: "test", [ "a", "b"], ["a", "g", "_"] ] will remove the first occurrence of test, replace the first occurrence of "a" with "b", and replace all other occurrences of "a" with "_".

Regex Replacement Array

An array of one to 3 elements like so: [pattern] or [pattern, replacementText] or [pattern, regexOptions, replacementText]. Replacement text defaults to ''.