javascript - Include whole directory of scripts using Jade? -


is possible include whole directory of scripts jade? current scripts.jade file looks this:

script(type="text/javascript", src="/vendor/angular.js") script(type="text/javascript", src="/vendor/angular-resource.js") script(type="text/javascript", src="/vendor/angular-route.js") script(type="text/javascript", src="/core.js") 

i hoping this:

script(type="text/javascript", src="/vendor/*.js") 

or this:

<!-- include: "type": "js", "files": "/vendor/*.js" --> 

any ideas?

there no possibility use such wildcards in jade, has no such notion of filesystem.

you can create mixin bit though, example:

mixin scripts(path, names)   - each name in names       script(type="text/javascript", src=path+name+".js")  +scripts("/vendor/", ["angular", "angular-resource", "angular-route"]) 

for possibility of automatical scripts injection html/jade/etc. code, should use build system, e.g. gulp gulp-inject plugin https://www.npmjs.com/package/gulp-inject


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -