@madebyseed/seed-cli-tools 1.2.3 → 1.2.5
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.
- package/lib/tasks/build-css.js +1 -1
- package/lib/tasks/build-svg.js +1 -5
- package/lib/tasks/includes/config.js +11 -4
- package/lib/tasks/includes/utilities.js +0 -43
- package/package.json +3 -4
- package/src/tasks/build-css.js +1 -1
- package/src/tasks/build-svg.js +0 -4
- package/src/tasks/includes/config.js +10 -3
- package/src/tasks/includes/utilities.js +0 -38
package/lib/tasks/build-css.js
CHANGED
|
@@ -23,7 +23,7 @@ var messages = require('./includes/messages.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
function processCss() {
|
|
26
|
-
return gulp.src(config.roots.css).pipe(plumber()).pipe(sass().on('error', sass.logError)).pipe(
|
|
26
|
+
return gulp.src(config.roots.css).pipe(plumber()).pipe(postcss(config.plugins.postcss)).pipe(sass().on('error', sass.logError)).pipe(gulp.dest(config.dist.assets));
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Concatenate css via gulp-cssimport
|
package/lib/tasks/build-svg.js
CHANGED
|
@@ -10,10 +10,6 @@ var size = require('gulp-size');
|
|
|
10
10
|
|
|
11
11
|
var chokidar = require('chokidar');
|
|
12
12
|
|
|
13
|
-
var svgmin = require('gulp-svgmin');
|
|
14
|
-
|
|
15
|
-
var cheerio = require('gulp-cheerio');
|
|
16
|
-
|
|
17
13
|
var extReplace = require('gulp-ext-replace');
|
|
18
14
|
|
|
19
15
|
var plumber = require('gulp-plumber');
|
|
@@ -35,7 +31,7 @@ var messages = require('./includes/messages.js');
|
|
|
35
31
|
|
|
36
32
|
function processIcons(files) {
|
|
37
33
|
messages.logProcessFiles('build:svg');
|
|
38
|
-
return gulp.src(files).pipe(plumber(utils.errorHandler)).pipe(
|
|
34
|
+
return gulp.src(files).pipe(plumber(utils.errorHandler)).pipe(extReplace('.liquid')).pipe(size({
|
|
39
35
|
showFiles: true,
|
|
40
36
|
pretty: true
|
|
41
37
|
})).pipe(gulp.dest(config.dist.snippets));
|
|
@@ -10,6 +10,8 @@ var tailwindcss = require("tailwindcss");
|
|
|
10
10
|
|
|
11
11
|
var cssnano = require("cssnano");
|
|
12
12
|
|
|
13
|
+
var pxtorem = require('postcss-pxtorem');
|
|
14
|
+
|
|
13
15
|
var argv = require("minimist")(process.argv.slice(2));
|
|
14
16
|
|
|
15
17
|
var themeRoot = findRoot(process.cwd());
|
|
@@ -103,12 +105,17 @@ var config = {
|
|
|
103
105
|
css: "src/styles/*.{css,scss}"
|
|
104
106
|
},
|
|
105
107
|
plugins: {
|
|
106
|
-
cheerio: {
|
|
107
|
-
run: require("./utilities.js").processSvg
|
|
108
|
-
},
|
|
109
108
|
postcss: [require('postcss-import'), tailwindcss({
|
|
110
109
|
config: join(themeRoot, tailwindConfig)
|
|
111
|
-
}), require('autoprefixer')
|
|
110
|
+
}), require('autoprefixer'), pxtorem({
|
|
111
|
+
rootValue: 16,
|
|
112
|
+
unitPrecision: 5,
|
|
113
|
+
propList: ['*'],
|
|
114
|
+
selectorBlackList: [],
|
|
115
|
+
replace: true,
|
|
116
|
+
mediaQuery: true,
|
|
117
|
+
exclude: /node_modules/i
|
|
118
|
+
})]
|
|
112
119
|
}
|
|
113
120
|
};
|
|
114
121
|
|
|
@@ -67,49 +67,6 @@ var utilities = {
|
|
|
67
67
|
}).thenReturn(results).all();
|
|
68
68
|
},
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
* Function passed to cheerio.run - adds aria tags & other accessibility
|
|
72
|
-
* based information to each svg element's markup...
|
|
73
|
-
*
|
|
74
|
-
* @memberof seed-cli.utilities
|
|
75
|
-
* @param {Function} $ - jQuery reference
|
|
76
|
-
* @param {fs} file - reference to current icon file?
|
|
77
|
-
*/
|
|
78
|
-
processSvg: function processSvg($, file) {
|
|
79
|
-
var $svg = $("svg"); // eslint-disable-line no-var
|
|
80
|
-
|
|
81
|
-
var $newSvg = $('<svg aria-hidden="true" focusable="false" role="presentation" class="icon" />'); // eslint-disable-line no-var
|
|
82
|
-
|
|
83
|
-
var fileName = file.relative.replace(".svg", ""); // eslint-disable-line no-var
|
|
84
|
-
|
|
85
|
-
var viewBoxAttr = $svg.attr("viewbox"); // eslint-disable-line no-var
|
|
86
|
-
// Add necessary attributes
|
|
87
|
-
|
|
88
|
-
if (viewBoxAttr) {
|
|
89
|
-
var width = parseInt(viewBoxAttr.split(" ")[2], 10); // eslint-disable-line no-var
|
|
90
|
-
|
|
91
|
-
var height = parseInt(viewBoxAttr.split(" ")[3], 10); // eslint-disable-line no-var
|
|
92
|
-
|
|
93
|
-
var widthToHeightRatio = width / height; // eslint-disable-line no-var
|
|
94
|
-
|
|
95
|
-
if (widthToHeightRatio >= 1.5) {
|
|
96
|
-
$newSvg.addClass("icon--wide");
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
$newSvg.attr("viewBox", viewBoxAttr);
|
|
100
|
-
} // Add required classes to full color icons
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (file.relative.indexOf("-full-color") >= 0) {
|
|
104
|
-
$newSvg.addClass("icon--full-color");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
$newSvg.addClass(fileName).append($svg.contents());
|
|
108
|
-
$newSvg.append($svg.contents());
|
|
109
|
-
$svg.after($newSvg);
|
|
110
|
-
$svg.remove();
|
|
111
|
-
},
|
|
112
|
-
|
|
113
70
|
/**
|
|
114
71
|
* Factory for creating an event cache - used with a short debounce to batch any
|
|
115
72
|
* file changes that occur in rapid succession during Watch tasks.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madebyseed/seed-cli-tools",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Seed CLI Tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"figures": "^3.2.0",
|
|
35
35
|
"find-root": "^1.1.0",
|
|
36
36
|
"gulp": "^4.0.2",
|
|
37
|
-
"gulp-cheerio": "^1.0.0",
|
|
38
37
|
"gulp-ext-replace": "^0.3.0",
|
|
39
38
|
"gulp-if": "^3.0.0",
|
|
40
39
|
"gulp-include": "^2.4.1",
|
|
@@ -42,16 +41,16 @@
|
|
|
42
41
|
"gulp-postcss": "^9.0.0",
|
|
43
42
|
"gulp-sass": "^5.0.0",
|
|
44
43
|
"gulp-size": "^4.0.1",
|
|
45
|
-
"gulp-svgmin": "^4.0.1",
|
|
46
44
|
"gulp-uglify": "^3.0.2",
|
|
47
45
|
"gulp-zip": "^5.1.0",
|
|
48
46
|
"postcss": "^8.3.6",
|
|
49
47
|
"postcss-import": "^14.0.2",
|
|
48
|
+
"postcss-pxtorem": "^6.0.0",
|
|
50
49
|
"require-directory": "^2.1.1",
|
|
51
50
|
"sass": "^1.36.0",
|
|
52
51
|
"tailwindcss": "^2.2.7",
|
|
53
52
|
"vinyl-paths": "^3.0.1",
|
|
54
53
|
"yargs": "^17.0.1"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "8c7eb999d4fdd1fa2ab54e591c56a82f64ccf07d"
|
|
57
56
|
}
|
package/src/tasks/build-css.js
CHANGED
|
@@ -18,8 +18,8 @@ const messages = require('./includes/messages.js');
|
|
|
18
18
|
function processCss() {
|
|
19
19
|
return gulp.src(config.roots.css)
|
|
20
20
|
.pipe(plumber())
|
|
21
|
-
.pipe(sass().on('error', sass.logError))
|
|
22
21
|
.pipe(postcss(config.plugins.postcss))
|
|
22
|
+
.pipe(sass().on('error', sass.logError))
|
|
23
23
|
.pipe(gulp.dest(config.dist.assets));
|
|
24
24
|
}
|
|
25
25
|
|
package/src/tasks/build-svg.js
CHANGED
|
@@ -3,8 +3,6 @@ const vinylPaths = require('vinyl-paths');
|
|
|
3
3
|
const del = require('del');
|
|
4
4
|
const size = require('gulp-size');
|
|
5
5
|
const chokidar = require('chokidar');
|
|
6
|
-
const svgmin = require('gulp-svgmin');
|
|
7
|
-
const cheerio = require('gulp-cheerio');
|
|
8
6
|
const extReplace = require('gulp-ext-replace');
|
|
9
7
|
const plumber = require('gulp-plumber');
|
|
10
8
|
|
|
@@ -24,8 +22,6 @@ function processIcons(files) {
|
|
|
24
22
|
messages.logProcessFiles('build:svg');
|
|
25
23
|
return gulp.src(files)
|
|
26
24
|
.pipe(plumber(utils.errorHandler))
|
|
27
|
-
.pipe(svgmin())
|
|
28
|
-
.pipe(cheerio(config.plugins.cheerio))
|
|
29
25
|
.pipe(extReplace('.liquid'))
|
|
30
26
|
.pipe(size({
|
|
31
27
|
showFiles: true,
|
|
@@ -3,6 +3,7 @@ const logger = require("debug")("seed-tools");
|
|
|
3
3
|
const findRoot = require("find-root");
|
|
4
4
|
const tailwindcss = require("tailwindcss");
|
|
5
5
|
const cssnano = require("cssnano");
|
|
6
|
+
const pxtorem = require('postcss-pxtorem');
|
|
6
7
|
const argv = require("minimist")(process.argv.slice(2));
|
|
7
8
|
const themeRoot = findRoot(process.cwd());
|
|
8
9
|
const tailwindConfig = 'tailwind.config.js'
|
|
@@ -103,13 +104,19 @@ const config = {
|
|
|
103
104
|
},
|
|
104
105
|
|
|
105
106
|
plugins: {
|
|
106
|
-
cheerio: {
|
|
107
|
-
run: require("./utilities.js").processSvg,
|
|
108
|
-
},
|
|
109
107
|
postcss: [
|
|
110
108
|
require('postcss-import'),
|
|
111
109
|
tailwindcss({ config: join(themeRoot, tailwindConfig) }),
|
|
112
110
|
require('autoprefixer'),
|
|
111
|
+
pxtorem({
|
|
112
|
+
rootValue: 16,
|
|
113
|
+
unitPrecision: 5,
|
|
114
|
+
propList: ['*'],
|
|
115
|
+
selectorBlackList: [],
|
|
116
|
+
replace: true,
|
|
117
|
+
mediaQuery: true,
|
|
118
|
+
exclude: /node_modules/i
|
|
119
|
+
})
|
|
113
120
|
],
|
|
114
121
|
},
|
|
115
122
|
};
|
|
@@ -65,44 +65,6 @@ const utilities = {
|
|
|
65
65
|
.all();
|
|
66
66
|
},
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* Function passed to cheerio.run - adds aria tags & other accessibility
|
|
70
|
-
* based information to each svg element's markup...
|
|
71
|
-
*
|
|
72
|
-
* @memberof seed-cli.utilities
|
|
73
|
-
* @param {Function} $ - jQuery reference
|
|
74
|
-
* @param {fs} file - reference to current icon file?
|
|
75
|
-
*/
|
|
76
|
-
processSvg: ($, file) => {
|
|
77
|
-
var $svg = $("svg"); // eslint-disable-line no-var
|
|
78
|
-
var $newSvg = $(
|
|
79
|
-
'<svg aria-hidden="true" focusable="false" role="presentation" class="icon" />'
|
|
80
|
-
); // eslint-disable-line no-var
|
|
81
|
-
var fileName = file.relative.replace(".svg", ""); // eslint-disable-line no-var
|
|
82
|
-
var viewBoxAttr = $svg.attr("viewbox"); // eslint-disable-line no-var
|
|
83
|
-
|
|
84
|
-
// Add necessary attributes
|
|
85
|
-
if (viewBoxAttr) {
|
|
86
|
-
var width = parseInt(viewBoxAttr.split(" ")[2], 10); // eslint-disable-line no-var
|
|
87
|
-
var height = parseInt(viewBoxAttr.split(" ")[3], 10); // eslint-disable-line no-var
|
|
88
|
-
var widthToHeightRatio = width / height; // eslint-disable-line no-var
|
|
89
|
-
if (widthToHeightRatio >= 1.5) {
|
|
90
|
-
$newSvg.addClass("icon--wide");
|
|
91
|
-
}
|
|
92
|
-
$newSvg.attr("viewBox", viewBoxAttr);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Add required classes to full color icons
|
|
96
|
-
if (file.relative.indexOf("-full-color") >= 0) {
|
|
97
|
-
$newSvg.addClass("icon--full-color");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
$newSvg.addClass(fileName).append($svg.contents());
|
|
101
|
-
|
|
102
|
-
$newSvg.append($svg.contents());
|
|
103
|
-
$svg.after($newSvg);
|
|
104
|
-
$svg.remove();
|
|
105
|
-
},
|
|
106
68
|
|
|
107
69
|
/**
|
|
108
70
|
* Factory for creating an event cache - used with a short debounce to batch any
|