-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Include Javascript #58
Comments
Hi, Thanks for the report. Indeed, the equivalent syntax does not exist yet in pug-php. First remember that: script(src="script.js") is very often a better option since you benefit the browser cache. For a complete and optimized way to handle your assets, I recommand you to use https://github.com/pug-php/pug-assets Else, for the moment you can include a whole script: include script script.pug: script.
console.log('Foo bar'); |
I realize our unit tests are no longer up to date, the original jade-php repository I forked: script
if (foo) {
bar();
} No dot after script.
if (foo) {
bar();
} The script and style logice changed. Update this feature could cause regressions for anyone using raw script and no dot after the tag name, but it's the right way to match pugjs. I will think about the best way to implement this. |
Thanks for the report. In this case I would just need to add the dot to match. The only reason why I would like to have my js as external javascript file is because of syntax highlight and eslint (in Atom). As for pug assets that's interesting (even more for the contact and minify options) but I'm not in a Symphony environment sadly. Thanks. |
Oh I see the error in the REAME. pug-assets is used by pug-symfony. But it can also be used without, I will fix the README. Note that pug-assets use pug-minify (a keyword that you can also use alone). You can right now try the fix on the branch include-script (use the version "dev-include-script" in composer), this will be merged with the version 2.3. |
2.3 is released. Thanks again for your help. |
Hello, first thanks for this library great work, I'm happy to be able to use Jade/pug as my templating engine. I ran over an issue which I suppose is related to parsing. In pugJS you can include an external Javascript file in a template by writing
http://jade-lang.com/reference/includes/
However in pugPHP it's interpreting it as javascript and outputing
Is it an easy fix? For now I will just put my script in a pug file and include it.
The text was updated successfully, but these errors were encountered: