Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('check:html', [], () =>
gulp
.src('staticweb/**/*.html', { cwd: projectPath })
.pipe(
gulpif(
!process.env.WEBCUBE_DISABLE_HTMLHINT,
htmlhint({
// https://github.com/yaniswang/HTMLHint/wiki/Rules
htmlhintrc: htmlhintrcPath,
})
)
)
.pipe(
gulpif(!process.env.WEBCUBE_DISABLE_HTMLHINT, htmlhint.failReporter())
)
);
export const html = () =>
gulp
.src('.html/*.html')
.pipe(
htmlhint({
// Rules documentation:
// https://github.com/yaniswang/HTMLHint/wiki/Rules
'alt-require': true,
'attr-lowercase': [
'viewBox',
'preserveAspectRatio',
'filterUnits',
'gradientTransform',
'stdDeviation',
'autoComplete'
],
'attr-no-duplication': true,
'attr-unsafe-chars': true,
'attr-value-double-quotes': true,
'attr-value-not-empty': true,
'doctype-html5': true,
gulp.task('lint-html', () => {
return gulp.src(join(SOURCE_ROOT, '**/*.html'))
.pipe(htmlhint('.htmlhintrc'))
.pipe(htmlhint.reporter());
});
gulp.task("build-html", function () {
return gulp.src("src/**/*.html")
.pipe(fileinclude({
prefix: "@@",
basepath: "@file"
}))
.pipe(hashsrc({
build_dir: "./Server/web",
src_path: "./src"
}))
.pipe(htmlhint())
.pipe(htmlhint.reporter())
.pipe(htmlMinifier({
collapseWhitespace: true,
removeComments: true
}))
.pipe(gulp.dest("Server/web"))
.pipe(livereload());
});
gulp.task('templates', function() {
return gulp.src(source.templates.app.files)
.pipe(jade({
pretty: true
}))
.on("error", handleError)
.pipe(htmlhint())
.pipe(htmlhint.reporter())
.pipe(gulp.dest(build.templates.app))
;
});
function generateHtmlhintTask(env) {
var src;
switch (env.toLowerCase()) {
case 'test':
src = [].concat(paths.app.html, paths.app.templates, paths.test.unit.fixtures);
break;
default: //(dev)
src = [].concat(paths.app.html, paths.app.templates);
break;
}
return gulp.src(src)
.pipe(htmlhint('.htmlhintrc'))
.pipe(htmlhint.reporter())
.pipe(htmlhint.failReporter());
}
gulp.task('lint:html:built', function() {
return gulp.src(config.lint.targets.built.html)
.pipe(plumber())
.pipe(htmlhint())
.pipe(htmlhint.reporter());
});
path =>
gulp.src( path, { dot: true } )
.pipe( htmlhint( '.htmlhintrc' ) )
.pipe( htmlhint.reporter( 'htmlhint-stylish' ) )
)
gulp.task('htmlhint', function () {
return gulp.src(config.global.dev + '/*.html')
.pipe(cached('htmlhint'))
.pipe(htmlhint('.htmlhintrc'))
.pipe(htmlhint.reporter('htmlhint-stylish'));
});
gulp.task('lint:html', function() {
return gulp.src(path.join(conf.paths.src, '**/**.html'))
.pipe(htmlhint(hintOptions))
.pipe(htmlhint.reporter());
});