@lipemat/js-boilerplate 9.1.0 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,25 +5,30 @@ const {getLocalIdent} = require( '../helpers/css-classnames' );
5
5
  * Options for the Webpack `css-loader`.
6
6
  *
7
7
  * Extracted to its on file to allow easy overrides.
8
+ */
9
+
10
+ /**
11
+ * Default to :global for classes in "global" or "pcss" directories.
8
12
  *
9
- * @since 8.6.0
13
+ * @param {string} resourcePath
14
+ * @return {string}
10
15
  */
16
+ const mode = resourcePath => {
17
+ if ( /globals?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
18
+ return 'global';
19
+ }
20
+ if ( /pcss?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
21
+ return 'global';
22
+ }
23
+ return 'local';
24
+ };
11
25
 
12
26
  let cssLoader = {
13
27
  importLoaders: 1,
14
28
  modules: {
15
29
  exportLocalsConvention: 'camelCase',
16
30
  localIdentName: 'Ⓜ[name]__[local]__[contenthash:base64:2]',
17
- // Default to :global for classes in "global" or "pcss" directories.
18
- mode: resourcePath => {
19
- if ( /globals?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
20
- return 'global';
21
- }
22
- if ( /pcss?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
23
- return 'global';
24
- }
25
- return 'local';
26
- },
31
+ mode,
27
32
  },
28
33
  sourceMap: true,
29
34
  url: false,
@@ -38,10 +43,7 @@ if ( 'production' === process.env.NODE_ENV ) {
38
43
  ...config.shortCssClasses ? {getLocalIdent} : {},
39
44
  // Hash used when short CSS classes are not enabled.
40
45
  localIdentName: '[contenthash:base64:5]',
41
- // Default to :global for classes in "global" directories.
42
- mode: resourcePath => {
43
- return /globals?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ? 'global' : 'local';
44
- },
46
+ mode,
45
47
  },
46
48
  url: false,
47
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",