Comments (11)
by 'bundler plugin', do you mean having a plugin to do deno bundle
? swc, on which Deno is built, is working on implementing a port for Terser to add to this. I'm using denopack, which uses the browser version of Rollup/Terser, for bundling/minifying. Their roadmap mentions adding 'static generation', so perhaps there's scope for working together?
from lume.
The idea is that existing processors like css (which uses postcss) or svg (which uses svgo) can be used also as template filters, to transform inline sources.
The bundle
processor uses the built-in Deno.bundle()
(see here: https://github.com/lumeland/lume/blob/master/plugins/bundler.js).
Any other bundler like denopack can be used (it's really easy to create more plugins for Lume). I'll take a look to Denopack.
Thanks!
from lume.
ok. Maybe an example in the docs of how to create a plugin? There's a couple of issues with Denopack, but basically it works well. I'll look into creating a Terser plugin, which would be useful for minifying js without bundling.
I'd suggest standardising the docs to use the same terms throughout. For example, the home page talks of "transformers", but I don't think this word is used anywhere else. Does this mean both plugins and filters? https://lumeland.github.io/creating-pages/filters/ says, under md
, "It's installed by the markdown plugin", which is correct, but at the top it says "New plugins must be registered" which I think should be 'filters'.
from lume.
Yes, right. "New plugins must be registered" is a typo, it should say "New filters". I'm fixing it.
I have to complete the docs with info about extending Lume with new plugins, transformers, filters, etc.
I just added docs for loaders (https://lumeland.github.io/advanced/loaders/).
from lume.
I just added some documentation for processors, engines and plugins.
from lume.
For minification, we could use deno_swc which allows us to use SWC for creating an AST, and it also has built in minification in the stringification of that AST.
import { parse, print } from "https://x.nest.land/[email protected]/mod.ts";
const code = await Deno.transpileOnly("const x: string = 'asdf';");
const thing = parse(code, {
syntax: "ecmascript"
});
console.log(print(thing, {
minify: true,
}))
from lume.
looks like deno_swc uses Terser (via esm.sh and Wasm) for minification. Seems rather a roundabout way of using Terser :-). swc-project/swc#1302 is swc's current work on adding a Terser port. denoland/deno#6900 is Deno's issue for incorporating this in Deno bundle. denopack's using the browser version of Terser looks like the best way forward to me. A Lume plugin could easily do something like the shell script in terser/terser#544 (comment).
from lume.
Have you tried https://github.com/timreichen/Bundler?
from lume.
looks interesting - something else for me to investigate. :-) Also uses Terser from esm.sh.
from lume.
AFAICS, Bundler does no tree-shaking. So I'm sceptical how much use it is for browsers. Might be ok for Deno though, where bundle size is not so important.
from lume.
Instead creating filters for every processor (css, bundle, svg etc), I finally created the inline
processor, to insert automatically in the html the code of any resouce with the inline
attribute. For example:
<link rel="stylesheet" href="styles.css" inline>
<script src="script.js" inline></script>
<img src="image.png" inline>
<img src="image.svg" inline>
Is converted to:
<style>
/* Styles here */
</style>
<script>
/* Scripts here */
</script>
<img src="data:image/png;base64,...">
<svg>
/* Svg code here */
</svg>
from lume.
Related Issues (20)
- (remark): Support for passing through remarkRehype configuration HOT 8
- Picture/Imagick fails to display image starting with a date in the filename HOT 6
- Cannot copy nested directory starting with underscore prefix HOT 2
- nunjucks include in for loop breaks build HOT 2
- Lightning CSS canβt be configured to use a different includes folder HOT 3
- Picture plugin doesn't optimize image HOT 2
- Remove deno.lock file on upgrade Lume
- Multilanguage plugin: support x-default HOT 1
- Transform Images plugin should avoid upsizing images have smaller size than the resize options. HOT 2
- page.search with `url` not working HOT 3
- Split core functionality in `mod.ts` HOT 2
- Rename the first param of Processor callback type
- Image transform does not work with all caps JPG extension HOT 3
- robots.txt plugin HOT 6
- Upgrading to Lume 2.0.x is breaking the build HOT 2
- "vto is not defined" HOT 4
- Client side Javascript broken (or works differently) in lume 2.0.x HOT 9
- JSX onclick attributes are stripped during build HOT 3
- Denying env permission for LUME_LOGS and LUME_NOCACHE should not be fatal HOT 3
- Nested components doesn't work (official doc example) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lume.