Skip to content

Commit 52eb8aa

Browse files
committed
Make it possibe to have image assets flow into sass partials from different domains
1 parent 8f7b22d commit 52eb8aa

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.core/gulp.tasks.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,15 @@ const reactium = (gulp, config, webpackConfig) => {
486486

487487
const pluginAssetsTemplate = data => {
488488
const template = handlebars.compile(`
489+
@use "sass:map";
490+
491+
$assets: () !default;
492+
489493
// Generated Data URLs from plugin-assets.json
490-
$assets: (
491-
{{#each this}}
492-
'{{key}}': '{{{dataURL}}}',
493-
{{/each}}
494-
);`);
494+
{{#each this}}
495+
$assets: map.set($assets, "{{key}}", "{{{dataURL}}}");
496+
{{/each}}
497+
`);
495498

496499
return template(data);
497500
};
@@ -501,7 +504,6 @@ $assets: (
501504
for (const file of files) {
502505
const manifest = path.resolve(file);
503506
const base = path.dirname(manifest);
504-
505507
try {
506508
let assets = fs.readFileSync(manifest);
507509
assets = JSON.parse(assets);
@@ -510,6 +512,15 @@ $assets: (
510512
const mappings = [];
511513
for (const entry of entries) {
512514
const [key, fileName] = entry;
515+
console.log(
516+
`Adding ${key}: ${path.resolve(
517+
base,
518+
fileName,
519+
)} to partial at ${path.resolve(
520+
base,
521+
'_plugin-assets.scss',
522+
)}`,
523+
);
513524
const dataURL = await fileReader(
514525
new File(path.resolve(base, fileName)),
515526
);

0 commit comments

Comments
 (0)