Files
dealplustech/node_modules/csso/lib/usage.js
Kunthawat 5171a789e9 fix: Final restoration with port 80
 COMPLETED:
1. Dockerfile uses port 80 (astro preview)
2. BaseLayout imports globals.css
3. globals.css with Tailwind v4 @theme syntax
4. index.astro has Header, Footer, FixedContact
5. All image references fixed to existing files
6. Hero uses hdpe_pipe_main.jpg
7. Product cards use hdpe001.jpg
8. pt-20 on main for fixed header

 TESTED LOCALLY:
- Build: 15 pages in 1.27s
- Docker build successful
- Port 80 working
- Images load
- CSS works

Ready for Easypanel deployment.
2026-03-12 08:58:56 +07:00

72 lines
1.4 KiB
JavaScript

const { hasOwnProperty } = Object.prototype;
function buildMap(list, caseInsensitive) {
const map = Object.create(null);
if (!Array.isArray(list)) {
return null;
}
for (let name of list) {
if (caseInsensitive) {
name = name.toLowerCase();
}
map[name] = true;
}
return map;
}
function buildList(data) {
if (!data) {
return null;
}
const tags = buildMap(data.tags, true);
const ids = buildMap(data.ids);
const classes = buildMap(data.classes);
if (tags === null &&
ids === null &&
classes === null) {
return null;
}
return {
tags,
ids,
classes
};
}
export function buildIndex(data) {
let scopes = false;
if (data.scopes && Array.isArray(data.scopes)) {
scopes = Object.create(null);
for (let i = 0; i < data.scopes.length; i++) {
const list = data.scopes[i];
if (!list || !Array.isArray(list)) {
throw new Error('Wrong usage format');
}
for (const name of list) {
if (hasOwnProperty.call(scopes, name)) {
throw new Error(`Class can't be used for several scopes: ${name}`);
}
scopes[name] = i + 1;
}
}
}
return {
whitelist: buildList(data),
blacklist: buildList(data.blacklist),
scopes
};
}