@jamesblanksby/toolkit 1.0.0 → 1.1.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.
- package/build/shopify.js +6 -6
- package/package.json +10 -10
- package/src/file.js +3 -3
package/build/shopify.js
CHANGED
|
@@ -8,10 +8,10 @@ const { PWD, } = process.env;
|
|
|
8
8
|
|
|
9
9
|
function flattenAsset(file, type) {
|
|
10
10
|
const name = path.relative(PWD, file.path)
|
|
11
|
-
.replace(new RegExp(
|
|
12
|
-
.replace(
|
|
11
|
+
.replace(new RegExp(`src/${type}/?`), '')
|
|
12
|
+
.replace(new RegExp('/', 'g'), '_');
|
|
13
13
|
|
|
14
|
-
return new MemoryFile(name, file.
|
|
14
|
+
return new MemoryFile(name, file.buffer);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function flattenCss(file) {
|
|
@@ -22,9 +22,9 @@ function flattenCss(file) {
|
|
|
22
22
|
const name = `${path.basename(file.path)}.liquid`;
|
|
23
23
|
|
|
24
24
|
const result = file.contents
|
|
25
|
-
.replace(
|
|
26
|
-
.replace(
|
|
27
|
-
const resource = match.replace(
|
|
25
|
+
.replace(new RegExp('../(font|gfx)/', 'g'), '')
|
|
26
|
+
.replace(new RegExp('url\\((.*?)\\)', 'g'), (_, match) => {
|
|
27
|
+
const resource = match.replace(new RegExp('/', 'g'), '_');
|
|
28
28
|
return `url({{ '${resource}' | asset_url }})`;
|
|
29
29
|
});
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamesblanksby/toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"toolkit": "bin/toolkit.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"browser-sync": "^3.0.
|
|
19
|
+
"browser-sync": "^3.0.3",
|
|
20
20
|
"chalk": "^5.3.0",
|
|
21
|
-
"chokidar": "
|
|
22
|
-
"cssnano": "^
|
|
23
|
-
"eslint": "^
|
|
21
|
+
"chokidar": "3.6.0",
|
|
22
|
+
"cssnano": "^7.0.6",
|
|
23
|
+
"eslint": "^9.13.0",
|
|
24
24
|
"fast-glob": "^3.3.2",
|
|
25
|
-
"minimatch": "^
|
|
26
|
-
"postcss
|
|
27
|
-
"postcss": "^
|
|
28
|
-
"sass": "
|
|
29
|
-
"uglify-js": "^3.
|
|
25
|
+
"minimatch": "^10.0.1",
|
|
26
|
+
"postcss": "^8.4.47",
|
|
27
|
+
"postcss-preset-env": "^10.0.7",
|
|
28
|
+
"sass": "1.79.6",
|
|
29
|
+
"uglify-js": "^3.19.3"
|
|
30
30
|
},
|
|
31
31
|
"browserslist": [
|
|
32
32
|
"> 0.25% and not dead"
|
package/src/file.js
CHANGED
|
@@ -28,7 +28,7 @@ class MemoryFile extends File {
|
|
|
28
28
|
constructor(path, contents) {
|
|
29
29
|
super(path);
|
|
30
30
|
|
|
31
|
-
this.#buffer =
|
|
31
|
+
this.#buffer = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
get buffer() {
|
|
@@ -46,8 +46,8 @@ class MemoryFile extends File {
|
|
|
46
46
|
|
|
47
47
|
class DiskFile extends File {
|
|
48
48
|
async read() {
|
|
49
|
-
const
|
|
50
|
-
return new MemoryFile(this.path,
|
|
49
|
+
const contents = await fs.readFile(this.path);
|
|
50
|
+
return new MemoryFile(this.path, contents);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|