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
Post a Comment