@caweb/webpack 1.4.0-beta.2 → 1.4.0

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.
@@ -0,0 +1,41 @@
1
+ export default function bsAttr(util, opt, options ) {
2
+ // Check if the utility is valid
3
+ switch ( util ) {
4
+ case 'text':
5
+ if( 'left' === opt ){
6
+ opt = 'start';
7
+ }else if( 'right' === opt ){
8
+ opt = 'end';
9
+ }
10
+
11
+ break;
12
+ case 'spacing':
13
+ util = 'm';
14
+
15
+ if( 'string' === typeof options && 'm' === options ){
16
+ util = options;
17
+ };
18
+
19
+ switch ( opt ) {
20
+ case 'left':
21
+ util +='e';
22
+ opt = 'auto';
23
+ break;
24
+
25
+ case 'center':
26
+ util +='x';
27
+ opt = 'auto';
28
+ break;
29
+
30
+ case 'right':
31
+ util +='s';
32
+ opt = 'auto';
33
+ break;
34
+ }
35
+
36
+ break;
37
+ }
38
+
39
+ return opt ? ` ${util}-${opt}` : '';
40
+
41
+ }
@@ -1,25 +1,52 @@
1
1
  export default function ifCond(v1, operator, v2, options){
2
+ let answer = false;
3
+
2
4
  switch(operator){
3
5
  case '&&':
4
- return ( v1 && v2 ) ? options.fn(this) : options.inverse(this);
5
- case '||':
6
- return ( v1 || v2 ) ? options.fn(this) : options.inverse(this);
6
+ answer = v1 && v2;
7
+ break;
8
+ case '||':
9
+ answer = v1 || v2 ;
10
+ break;
7
11
  case '==':
8
- return ( v1 == v2 ) ? options.fn(this) : options.inverse(this);
12
+ answer = v1 == v2 ;
13
+ break;
9
14
  case '===':
10
- return ( v1 === v2 ) ? options.fn(this) : options.inverse(this);
15
+ answer = v1 === v2;
16
+ break;
11
17
  case '!=':
12
- return ( v1 != v2 ) ? options.fn(this) : options.inverse(this);
18
+ answer = v1 != v2 ;
19
+ break;
13
20
  case '!==':
14
- return ( v1 !== v2 ) ? options.fn(this) : options.inverse(this);
21
+ answer = v1 !== v2 ;
22
+ break;
15
23
  case '<':
16
- return ( v1 < v2 ) ? options.fn(this) : options.inverse(this);
24
+ answer = v1 < v2 ;
25
+ break;
17
26
  case '<=':
18
- return ( v1 <= v2 ) ? options.fn(this) : options.inverse(this);
27
+ answer = v1 <= v2 ;
28
+ break;
19
29
  case '>':
20
- return ( v1 > v2 ) ? options.fn(this) : options.inverse(this);
30
+ answer = v1 > v2 ;
31
+ break;
21
32
  case '>=':
22
- return ( v1 >= v2 ) ? options.fn(this) : options.inverse(this);
33
+ answer = v1 >= v2 ;
34
+ break;
23
35
 
24
36
  }
37
+
38
+ // if the function is called as a block helper
39
+ // return the answer if true and the options has a fn
40
+ if( options['fn'] && answer ){
41
+ return options.fn(this);
42
+ // if the function is called as a block helper
43
+ // return the answer if false and the options has an inverse
44
+ }else if( options['inverse'] && !answer ){
45
+ return options.inverse(this);
46
+
47
+ // if the function is called as a subexpression
48
+ // return the answer
49
+ }else{
50
+ return answer;
51
+ }
25
52
  }
@@ -0,0 +1,3 @@
1
+ export default function not(response, options ) {
2
+ return ! response;
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/webpack",
3
- "version": "1.4.0-beta.2",
3
+ "version": "1.4.0",
4
4
  "description": "CAWebPublishing Webpack Configuration",
5
5
  "main": "webpack.config.js",
6
6
  "files": [
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "homepage": "https://github.com/CAWebPublishing/webpack#readme",
39
39
  "dependencies": {
40
- "@caweb/html-webpack-plugin": "^1.8.2",
41
- "@wordpress/scripts": "^30.16.0",
40
+ "@caweb/html-webpack-plugin": "^1.8.4",
41
+ "@wordpress/scripts": "^30.17.0",
42
42
  "css-minimizer-webpack-plugin": "^7.0.2",
43
43
  "handlebars-loader": "^1.7.3",
44
44
  "html-webpack-link-type-plugin": "^1.1.1",
package/webpack.config.js CHANGED
@@ -106,10 +106,28 @@ baseConfig.plugins.splice(1,1, false);
106
106
  */
107
107
  delete baseConfig.devServer;
108
108
 
109
+ let customTemplateHelpers = [];
110
+
109
111
  // we allow the user to pass custom template helpers
110
- const customTemplateHelpers = fs.existsSync(path.resolve('helpers'), {withFileTypes: true} ) ?
111
- fs.readdirSync(path.resolve('helpers'), {withFileTypes: true} ).filter( Dirent => Dirent.isDirectory() ).map( Dirent => path.resolve(Dirent.parentPath, Dirent.name) ) :
112
- [];
112
+
113
+ if( fs.existsSync(path.join(appPath, 'helpers'), {withFileTypes: true} ) ) {
114
+ // we add the helpers directory
115
+ customTemplateHelpers = [ path.join(appPath, 'helpers') ];
116
+
117
+ // we add any subdirectories
118
+ fs.readdirSync(
119
+ path.join(
120
+ appPath, 'helpers'
121
+ ),
122
+ {
123
+ withFileTypes: true,
124
+ recursive: true
125
+ }
126
+ )
127
+ .filter( Dirent => Dirent.isDirectory() )
128
+ .map( Dirent => customTemplateHelpers.push( path.resolve(Dirent.parentPath, Dirent.name) ) )
129
+
130
+ }
113
131
 
114
132
  // Wordpress ignores the webpack --mode flag
115
133
  // if the flag is passed we use that mode
@@ -194,6 +212,7 @@ let webpackConfig = {
194
212
  case 'footer':
195
213
  case 'header':
196
214
  case 'mobileControls':
215
+ case 'navFooter':
197
216
  case 'navHeader':
198
217
  case 'utilityHeader':
199
218
  partialDir = 'semantics';