pugjs / pug-www

The website for Pug.
15 stars 14 forks source link

Demo #6

Open TimothyGu opened 8 years ago

ForbesLindesay commented 7 years ago

This should ideally be a bit like a mini IDE for pug. Letting you create a number of pug files, and edit the locals provided to the pug files (with full JavaScript support, not just JSON). It should then let you view the resulting HTML (beautified and minified). It should also offer advanced options for viewing the JavaScript that's generated (by compileClient), the tokens, AST etc. at different stages in the parsing process.

Eventually, it would be great if it offered support for writing plugins in the browser.

It should ideally also support running against a local version of pug somehow (i.e. as much as possible it should probably be a separate app to the main pug website).

Since pugjs.org is a static website, this needs to all be done client side. The best way to achieve that is probably to build a mock file system that implements fs.readFileSync.

The final feature that is really important/exciting is that it should provide permalinks, so that you can create a demo of a bug using this web app, then provide that permalink in a GitHub issue.

TimothyGu commented 7 years ago

I believed Gist support was mentioned a while ago, and I do still think it's a good idea.

For a local version, we could probably use a Service Worker to cache the JS files.

ForbesLindesay commented 7 years ago

Yes, gist should allow us to keep the permalink urls short (lets us swap a bunch of files for a single number).

The local version would need to be some kind of tool you installed via npm. You'd then run something like:

pug-debugger --pug-linker ./

which would run this "app" with the current directory instead of the pug-linker published to npm.

TimothyGu commented 7 years ago

Sorry, I'm not sure I'm catching what you mean. So this pug-debugger program would be one such that has all the Pug modules bundled? Or is ./ a patched version of pug-linker, which pug-debugger just substitutes in for the pug-linker installed in node_modules?

ForbesLindesay commented 7 years ago

pug-debugger would bundle the latest versions of all the individual pug modules, but using --pug-linker ./ would override the bundled version with the patched version residing in ./, allowing you to test changes to the linker.