diff --git a/packages/nuekit/src/builder.js b/packages/nuekit/src/builder.js index 723c066d..35c091db 100644 --- a/packages/nuekit/src/builder.js +++ b/packages/nuekit/src/builder.js @@ -74,8 +74,9 @@ export function parseError(buildResult) { } -export async function lightningCSS(css, minify) { - const include = Features.Colors | Features.Nesting +export async function lightningCSS(css, minify, opts) { + let include = Features.Colors + if (!opts.css_2023) include |= Features.Nesting try { process.stdout.write('⚡️') diff --git a/packages/nuekit/src/nuekit.js b/packages/nuekit/src/nuekit.js index c7ed9659..9a1950fd 100644 --- a/packages/nuekit/src/nuekit.js +++ b/packages/nuekit/src/nuekit.js @@ -2,11 +2,11 @@ import { join, parse as parsePath, extname, basename } from 'node:path' import { renderHead, getDefaultHTML, getDefaultSPA } from './layout.js' import { parse as parseNue, compile as compileNue } from 'nuejs-core' -import { readStats, printTable, categorize } from './stats.js' import { log, colors, getAppDir, getParts } from './util.js' import { parsePage, renderPage } from 'nuemark/index.js' import { createServer, send } from './nueserver.js' import { lightningCSS, buildJS } from './builder.js' +import { printStats, categorize } from './stats.js' import { promises as fs } from 'node:fs' import { createSite } from './site.js' import { fswatch } from './nuefs.js' @@ -190,7 +190,7 @@ export async function createKit(args) { async function processCSS({ path, base, dir}) { const raw = await read(path) const data = await site.getData() - const css = data.lightning_css === false ? raw : await lightningCSS(raw, is_prod) + const css = data.lightning_css === false ? raw : await lightningCSS(raw, is_prod, data) await write(css, dir, base) return { css } } @@ -305,7 +305,8 @@ export async function createKit(args) { } // stats - if (args.stats) await stats() + if (args.stats) await stats(args) + const elapsed = Date.now() - begin console.log(`\nTime taken: ${colors.yellow(elapsed + 'ms')}\n`) @@ -314,6 +315,10 @@ export async function createKit(args) { return paths } + async function stats(args) { + await printStats(site, args) + } + async function serve() { log('Serving site from', colors.cyan(dist)) @@ -356,12 +361,6 @@ export async function createKit(args) { } } - async function stats() { - const rows = await readStats(dist, site.globals) - printTable(['Page', 'HTML', 'CSS', 'JS'], rows) - return rows - } - return { // for testing only