Skip to content

Commit

Permalink
re-enable with logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Jan 2, 2024
1 parent 75dd892 commit 65e8938
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion packages/namer/namer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ function value(source, count) {
return out;
}

module.exports = () => {
module.exports = ({ verbose = false } = false) => {
const meta = new Map();
const cache = new Map();

return function namer(file, selector) {
const key = `${file}${selector}`;


if(cache.has(key)) {
return cache.get(key);
}

if(!meta.has(file)) {
if(verbose) {
// eslint-disable-next-line no-console -- debug logging
console.log(`NAMER: Seen ${file} for the first time`);
}

meta.set(file, {
id : meta.size,
selectors : new Map(),
Expand All @@ -43,6 +49,11 @@ module.exports = () => {

cache.set(key, output);

if(verbose) {
// eslint-disable-next-line no-console -- debug logging
console.log(`NAMER: ${key} => ${output}`);
}

return output;
};
};
2 changes: 1 addition & 1 deletion packages/www/build/mcss-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const { preprocess, processor } = preprocessor({

// TODO: disabled because weird stuff is happening on Netlify, maybe around file paths?
// Crank down names in prod to be itty-bitty
// namer : isProd ? namer() : null,
namer : isProd ? namer({ verbose : true }) : null,

// Bring sveltekit aliases into m-css
resolvers : [
Expand Down

0 comments on commit 65e8938

Please sign in to comment.