File tree Expand file tree Collapse file tree 4 files changed +517
-349
lines changed
Expand file tree Collapse file tree 4 files changed +517
-349
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,12 @@ export default function (eleventyConfig) {
6868 "src/robots.txt" : "robots.txt"
6969 } )
7070
71+ if ( isDevelopment ) {
72+ eleventyConfig . addPassthroughCopy ( {
73+ "src/assets/js" : "js" ,
74+ } )
75+ }
76+
7177 eleventyConfig . addFilter ( "postDate" , ( dateObj ) => {
7278 if ( typeof dateObj !== "object" ) dateObj = new Date ( dateObj )
7379 return DateTime . fromJSDate ( dateObj ) . toLocaleString ( DateTime . DATE_MED )
Original file line number Diff line number Diff line change 11import { glob } from "glob" ;
2+ import chalk from "chalk" ;
23import { execSync } from "child_process" ;
34import path from "path" ;
45import fs from "fs" ;
56
67const files = glob . sync ( "src/assets/js/*.js" ) ;
8+ console . log (
9+ `${ chalk . gray ( `[` ) } ${ chalk . green ( `Ew` ) } ${ chalk . gray ( `/Terser]` ) } ` ,
10+ chalk . white ( `Minifying ${ files . length } file(s)` )
11+ ) ;
712for ( const file of files ) {
813 const out = path . join ( "public/js" , path . basename ( file ) ) ;
914 fs . mkdirSync ( path . dirname ( out ) , { recursive : true } ) ;
1015 execSync ( `terser "${ file } " -o "${ out } " -c -m` ) ;
11- console . log ( `Minified: ${ file } -> ${ out } ` ) ;
12- }
16+ console . log (
17+ `${ chalk . gray ( `[` ) } ${ chalk . green ( `Ew` ) } ${ chalk . gray ( `/Terser]` ) } ` ,
18+ chalk . white ( `Writing ${ out } ` ) ,
19+ chalk . gray ( `from ${ file } ` )
20+ ) ;
21+ }
22+ console . log (
23+ `${ chalk . gray ( `[` ) } ${ chalk . green ( `Ew` ) } ${ chalk . gray ( `/Terser]` ) } ` ,
24+ chalk . white ( `Minification complete ${ files . length } file(s)` )
25+ ) ;
You can’t perform that action at this time.
0 commit comments