Gathering detailed insights and metrics for gulp-vash-static
Gathering detailed insights and metrics for gulp-vash-static
Gathering detailed insights and metrics for gulp-vash-static
Gathering detailed insights and metrics for gulp-vash-static
npm install gulp-vash-static
Typescript
Module System
Node Version
NPM Version
35.4
Supply Chain
81.6
Quality
66.1
Maintenance
50
Vulnerability
96.6
License
JavaScript (100%)
Total Downloads
8,342
Last Day
1
Last Week
1
Last Month
13
Last Year
412
23 Commits
3 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
2.0.5
Package Id
gulp-vash-static@2.0.5
Size
11.56 kB
NPM Version
3.10.8
Node Version
6.9.1
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-66.7%
1
Compared to previous week
Last month
-45.8%
13
Compared to previous month
Last year
-24.1%
412
Compared to previous year
Gulp plugin for converting Vash razor templates to static html
Keep in mind that this is just a thin wrapper around Vash Static and your issue is most likely with that.
$ npm install --save-dev gulp-vash-static
There are a few different functions you can call:
This is my recommended setup, where all you need to call is 'gulp watch' to get started.
1var gulp = require('gulp');
2var vashStatic = require('gulp-vash-static');
3
4// The default is "pg" anyway, but this is just to show you that you can change it to another directory name if you wish
5vashStatic.setPageDirType("pg");
6
7var dirTypes = ["pg", "wg", "glb"]; // vashStatic module types
8var APP = "dev/app/";
9var PRECOMP_VASH = "precompiled-vash.json" // aka vash cache
10
11gulp.task("precompile-vash", function() {
12 return gulp.src([
13 APP + "pg/**/*.vash"
14 , APP + "wg/**/*.vash"
15 , APP + "glb/**/*.vash"
16 , "!" + APP + "glb/vash-helpers/*.vash" // leave out any vash helpers you have
17 ])
18 .pipe(vashStatic.precompile({
19 debugMode: true,
20 dirTypes: dirTypes,
21 modelsPath: "bld/js/models.js",
22 cacheFileName: PRECOMP_VASH
23 }))
24 .pipe(gulp.dest("bld/"))
25})
26
27
28gulp.task("pg-render-static", function() {
29
30 return gulp.src(APP + "pg/**/*.vash")
31 .pipe(vashStatic.renderPage({
32 cacheDest: "bld/" + PRECOMP_VASH
33 , helpers: [ APP "glb/vash-helpers/RenderWidget.vash" ] // optionally, you can add or override (same name) with custom helpers
34 , omitSubDir: "tmpl" //omit a subdirectory that you might have that you don't want to be part of the template name
35 }))
36 .pipe(gulp.dest("bld/"))
37})
38
39
40// Combines models so they can be injected into templates when rendering.
41// This is suggested if you need a separate model per page.
42// Recommend using TypeScript because of it's similar syntax to C# models, which makes integration of Razor front end and back end easier.
43gulp.task("combine-models", function () {
44
45 var src = [
46 APP + "pg/**/mdl/*.ts"
47 , APP + "wg/**/mdl/*.ts"
48 ];
49
50 return gulp.src(src)
51 .pipe(ts({
52 noImplicitAny: true,
53 out: 'models.js'
54 }))
55 .pipe(gulp.dest("bld/js/"));
56});
57
58
59/*
60Watches for any changes in vash templates or models, updates the precompiled template cache (on the file system), then renders the page marked by a flag (eg --home) by calling the 'pg-render-static' task.
61Note that 'vashStatic.watchModelsAndTemplates' is not a gulp plugin, just a convenience function that abstracts away some complex logic.
62Returns a stream from gulp plugin 'gulp-watch'.
63*/
64gulp.task("watch", function() {
65
66 var vashSrc = [ // vash templates
67 APP+"pg/**/*.vash"
68 , APP+"wg/**/*.vash"
69 ]
70 , modelSrc = [ // template models
71 APP + "pg/**/mdl/*.ts"
72 , APP + "wg/**/mdl/*.ts"
73 ]
74
75 return vashStatic.watchModelsAndTemplates({
76 gulp: gulp // pass in the instance of gulp you are using
77 , vashSrc: vashSrc
78 , modelSrc: modelSrc
79 , modelsDest: "bld/js/models.js" // your combined models to inject when rendering templates
80 , cacheDest: "bld/" + PRECOMP_VASH // cached templates JSON file, generated by 'precompile-vash' task
81 , debugMode: true // should be false for production to keep file size down
82 , dirTypes: dirTypes // module types, eg ['pg', 'wg', 'glb']
83 , pageTemplatePath: APP + "<%= type %>/<%= moduleName %>/tmpl/<%= fileName %>" // pattern to the vash template, using moduleName from the '--home' flag
84
85 // existing gulp tasks to call when files are changed
86 , combineModelsTask: 'combine-models'
87 , precompileTask: 'precompile-vash'
88 , pageRenderTask: 'pg-render-static'
89 })
90})
Vash Static uses modules to organise your templates. By default it assumes you have at least a page module, which is abbreviated to 'pg' and is expected in the directory structure. With 'setPageDirType' you can change this, if you need to.
Gets the argument from the command-line that starts with '--', omitting the '--' and finishing at the next space. The watch on models cannot detect the exact page that needs to be rendered, so assumes 'Index.vash'. You can specify a different page though by adding a '/MyPageName' (omit the file extension).
Allows you to optionally override the functionality of 'getAllArgs', so you can manipulate arguments. First param should be the function and it should return a manipulated string containing the page name.
Restores 'getAllArgs' after using 'overrideGetAllArgs'.
This can be useful if you don't want to output lots of warnings in things like unit tests (which can be annoying).
Precompiles a vash templates and generates a json file with the template's name and contents in it.
Precompiles a vash templates and generates a json file with the template's name and contents in it.
Convenience function for watching models and templates
getFirstArg
was replaced by getAllArgs
overrideGetFirstArg
was replaced by overrideGetAllArgs
restoreGetFirstArg
was replaced by restoreGetAllArgs
MIT © Jim Doyle
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More