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())
)
);
const analyzeHtmlContent = () => {
return gulp
.src(files.html)
.pipe(htmlhint('.htmlhintrc'))
.pipe(htmlhint.reporter('htmlhint-stylish'))
.pipe(htmlhint.failReporter({suppress: true}));
};
export function htmlhint() {
return gulp.src(lintingPaths.html)
.pipe(gulpHtmlhint('.htmlhintrc'))
.pipe(gulpHtmlhint.failReporter());
}
gulp.task( 'lint:htmlhint', () =>
gulp.src( [ '*.html' ] )
.pipe( htmlhint( '.htmlhintrc' ) )
.pipe( htmlhint.reporter( 'htmlhint-stylish' ) )
.pipe( htmlhint.failReporter( { suppress: true } ) )
);
pipes.scriptedPartialsProd = function() {
return pipes.validatedPartials()
.pipe(htmlhint.failReporter())
.pipe(htmlmin({collapseWhitespace: true, removeComments: true}))
.pipe(partials.compilePartialsInProd ? ngHtml2js({
moduleName: partials.partialsModuleName,
declareModule: false,
template: "$templateCache.put('<%= template.url %>','<%= template.escapedContent %>');"
}) : pipes.noop())
.pipe(partials.compilePartialsInProd ? concat("templates.min.js") : pipes.noop())
.pipe(partials.compilePartialsInProd ? tap(function(file) {file.contents = Buffer.concat([
new Buffer("(function(module){" +
"try{module=angular.module('" + partials.partialsModuleName + "');}" +
"catch(e){module=angular.module('" + partials.partialsModuleName + "', []);}" +
"module.run(['$templateCache',function($templateCache){"),
file.contents,
new Buffer("}]);})();")]);
}) : pipes.noop())
.pipe(partials.compilePartialsInProd ? uglify() : pipes.noop())
gulp.task('lint-html', function () {
var htmlhint = require('gulp-htmlhint')
return gulp.src(htmlSrc)
.pipe(htmlhint('.htmlhintrc'))
.pipe(htmlhint.failReporter())
})
gulp.task("htmlhint", function()
{
return gulp.src(["ui/**/*.html", "web/**/*.html"])
.pipe(htmlhint(".htmlhintrc"))
.pipe(htmlhint.failReporter());
});
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('htmllint', function() {
return gulp.src(files.htmllint)
.pipe(cache('htmllint'))
.pipe(htmlhint('.htmlhintrc'))
.pipe(htmlhint.reporter())
.pipe(gulpif(argv.production, htmlhint.failReporter()));
});