Skip to content

Commit

Permalink
css_2023 configuration option to enable CSS Baseline 2023 features su…
Browse files Browse the repository at this point in the history
…ch as nesting. Relates to #220
  • Loading branch information
tipiirai committed Mar 20, 2024
1 parent 6a7464b commit 367a614
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
5 changes: 3 additions & 2 deletions packages/nuekit/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('⚡️')
Expand Down
17 changes: 8 additions & 9 deletions packages/nuekit/src/nuekit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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`)
Expand All @@ -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))

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 367a614

Please sign in to comment.