@jamesblanksby/toolkit 1.4.0 → 1.5.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/README.md +1 -1
- package/build/sass.js +8 -6
- package/build/shopify.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/build/sass.js
CHANGED
|
@@ -47,18 +47,20 @@ async function createCssAndMapFile(css, map, source) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export default async function* sassCompile(files) {
|
|
50
|
+
const modulesDir = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), './../../..');
|
|
51
|
+
|
|
52
|
+
const options = {
|
|
53
|
+
loadPaths: [modulesDir,],
|
|
54
|
+
sourceMap: true,
|
|
55
|
+
};
|
|
56
|
+
|
|
50
57
|
for await (const file of files) {
|
|
51
58
|
const sassPaths = await findMainPaths(file.path);
|
|
52
59
|
|
|
53
|
-
const modulesDir = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), './../../..');
|
|
54
|
-
|
|
55
60
|
for (const sassPath of sassPaths) {
|
|
56
61
|
let result;
|
|
57
62
|
try {
|
|
58
|
-
result = sass.compile(sassPath,
|
|
59
|
-
loadPaths: [modulesDir,],
|
|
60
|
-
sourceMap: true,
|
|
61
|
-
});
|
|
63
|
+
result = sass.compile(sassPath, options);
|
|
62
64
|
} catch (error) {
|
|
63
65
|
throw new Error(error.message);
|
|
64
66
|
}
|
package/build/shopify.js
CHANGED
|
@@ -24,8 +24,12 @@ function flattenCss(file) {
|
|
|
24
24
|
|
|
25
25
|
const result = file.contents
|
|
26
26
|
.replace(new RegExp('../(font|gfx)/', 'g'), '')
|
|
27
|
-
.replace(new RegExp('url\\((.*?)
|
|
28
|
-
|
|
27
|
+
.replace(new RegExp('url\\([\'"]?(.*?)?[\'"]?\\)', 'g'), (_, match) => {
|
|
28
|
+
if (/^https?:\/\//.test(match)) {
|
|
29
|
+
return `url("${match}")`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const resource = match.replace(/\//g, '_');
|
|
29
33
|
return `url({{ '${resource}' | asset_url }})`;
|
|
30
34
|
});
|
|
31
35
|
|