Skip to content

WebReflection/ucdn-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

µcompress and µcdn basic example

Live demo

How to test this project

git clone https://github.com/WebReflection/ucdn-test.git
cd ucdn-test
npm i

How to build a ./public folder with optimized assets

npm run build

How does this work?

Source code is in the ./src folder. Once ucdn starts, it creates a ./cdn folder with all assets pre-optimized and pre-compressed.

Whenever a file changes, and the browser requests it, it will be re-generated with a cache lasting 1 second.

The cache can be increased or reduced via the --cache-timeout XXXX argument, where XXXX are milliseconds.

To discover all flags available in both ucdn and ucompress, feel free to run npm run help:cdn or npm run help:compress.

Where are dependencies?

While backend/processing dependencies should be defined in this project root, all front-end related dependencies should be defined in the ./src/package.json file. This is necessary in order to pre-resolve paths within the root of the front-end folder, but don't worry, only files related to the project will be optimized, once published, and JS files will automatically resolve to those dependencies as relative path, i.e. ../node_modules/uhtml/esm/index.js.