Skip to content
This repository has been archived by the owner on Mar 12, 2018. It is now read-only.

pug-runtime on bower/in the browser #34

Open
magnuspaaske opened this issue May 2, 2017 · 2 comments
Open

pug-runtime on bower/in the browser #34

magnuspaaske opened this issue May 2, 2017 · 2 comments

Comments

@magnuspaaske
Copy link

Hey

I hadn't seen this project after pug was renamed from jade, but I had been using jade-runtime before. I was thinking why there's no browser optimized version of the runtime so that it can be dropped into a project with no problems (preferably loaded from bower).

Not sure how it could best be done but I assume the main file could simply be used as a basis. Currently when I compile pug I need to add the functions anyways but it would be better to add it based on the common master.

/Magnus

@tedeh
Copy link

tedeh commented Jan 20, 2018

I'm sitting with an "ancient" project running requirejs and I had to do this in order to be able to use pug-runtime properly.

  1. Copy pug-runtime/index.js into a separate folder $FOLDER
  2. Remove the require('fs') line in index.js
  3. Run r.js -convert $FOLDER outputFileName
  4. Find the right output file (r.js is a super silly tool when it comes to parsing args) and rename it to pug-runtime.amd.js or something
  5. Rock and roll (I can now render pug in the browser)

@ForbesLindesay
Copy link
Member

The latest version of pug automatically generates the required runtime functions inline, so you shouldn’t need to reference pug-runtime. If you want to as a performance optimisation (if your app has a lot of pug templates), any CommonJS loader should work fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants