@lipemat/js-boilerplate 10.3.0-beta.3 → 10.3.0-beta.4

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.
@@ -29,24 +29,25 @@ const presetEnv = {
29
29
  };
30
30
 
31
31
  /**
32
- * If a media-queries files exist, automatically load them.
32
+ * Provide CSS properties and media queries to all postcss plugins.
33
33
  *
34
- * 1. pcss/globals/media-queries.pcss
35
- * 2. js/src/pcss/media-queries.pcss
34
+ * If a media-queries files exist, automatically load them.
35
+ * If CSS variables exist, automatically load them.
36
36
  *
37
- * @notice `@import` will not work inside the media-queries file so
38
- * there is no point in having a JS version if all it does is
39
- * import from the global pcss version.
37
+ * 1. pcss/globals/variables.pcss
38
+ * 2. js/src/pcss/variables.pcss
39
+ * 3. pcss/globals/media-queries.pcss
40
+ * 4. js/src/pcss/media-queries.pcss
40
41
  */
41
- const customMedia = {
42
- importFrom: [],
43
- };
42
+ const externalFiles = [];
44
43
  [
45
44
  path.resolve( packageConfig.packageDirectory, 'pcss/globals/media-queries.pcss' ),
45
+ path.resolve( packageConfig.packageDirectory, 'pcss/globals/variables.pcss' ),
46
46
  path.resolve( packageConfig.workingDirectory, 'src/pcss/media-queries.pcss' ),
47
+ path.resolve( packageConfig.workingDirectory, 'src/pcss/variables.pcss' ),
47
48
  ].forEach( possibleFile => {
48
49
  if ( fs.existsSync( possibleFile ) ) {
49
- customMedia.importFrom.push( possibleFile );
50
+ externalFiles.push( possibleFile );
50
51
  }
51
52
  } );
52
53
 
@@ -56,10 +57,13 @@ const customMedia = {
56
57
  */
57
58
  const config = {
58
59
  plugins: [
60
+ require( '@csstools/postcss-global-data' )( {
61
+ files: externalFiles,
62
+ } ),
59
63
  require( 'postcss-import' )( {
60
64
  skipDuplicates: false,
61
65
  } ),
62
- require( 'postcss-custom-media' )( customMedia ),
66
+ require( 'postcss-custom-media' ),
63
67
  require( 'postcss-nested' ),
64
68
  postcssPresetEnv( presetEnv ),
65
69
  require( 'postcss-color-mod-function' ),
package/helpers/config.js CHANGED
@@ -159,8 +159,6 @@ function getBrowsersList() {
159
159
  * Used in cases where we can fall back to standard browserslist config if the project
160
160
  * has not specified one.
161
161
  *
162
- * @deprecated Use getBrowsersList instead.
163
- *
164
162
  * @link https://github.com/browserslist/browserslist#config-file
165
163
  *
166
164
  * @return {boolean | string[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "10.3.0-beta.3",
3
+ "version": "10.3.0-beta.4",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",
@@ -42,6 +42,7 @@
42
42
  "@babel/preset-env": "^7.22.9",
43
43
  "@babel/preset-react": "^7.12.10",
44
44
  "@babel/preset-typescript": "^7.12.7",
45
+ "@csstools/postcss-global-data": "^2.0.0",
45
46
  "@lipemat/css-mqpacker": "^9.0.0",
46
47
  "@lipemat/eslint-config": "^3.0.1",
47
48
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
@@ -1,5 +1,6 @@
1
1
  const browserslist = require( 'browserslist' );
2
- const {getBrowsersList} = require( '../helpers/config' );
2
+ const {getBrowsersList, getDefaultBrowsersList} = require( '../helpers/config' );
3
+ const path = require( 'path' );
3
4
 
4
5
  const help = `
5
6
  List browsers being targeted by Babel and PostCSS.
@@ -18,7 +19,9 @@ if ( args[ 0 ] && ( '-h' === args[ 0 ] || '--help' === args[ 0 ] ) ) {
18
19
  }
19
20
 
20
21
 
21
- const provided = getBrowsersList();
22
+ const provided = getDefaultBrowsersList() || browserslist.loadConfig( {
23
+ path: path.resolve( '.' ),
24
+ } );
22
25
 
23
26
  console.log( '' );
24
27
  console.log( 'JS Provided Browserslist' );