How do you use Istanbul Code Coverage with transpiled Typescript?

TL;DR: There is a tool: https://github.com/SitePen/remap-istanbul described as A tool for remapping Istanbul coverage via Source Maps The article on Sitepan describes it in more detail: Intern as well as other JavaScript testing frameworks utilise Istanbul for their code coverage analysis. As we started to adopt more and more TypeScript for our own projects, we … Read more

Compile HTML partials with gulp.js

Yes, you can do it with this plugin called gulp-file-include Example : # index.html <!DOCTYPE html> <html> <body> @@include(‘./view.html’) @@include(‘./var.html’, { “name”: “haoxin”, “age”: 12345 }) </body> </html> # view.html <h1>view</h1> # var.html <label>@@name</label> <label>@@age</label>

what does gulp-“cli” stands for?

The goal of gulp-cli is to let you use gulp like a global program, but without installing gulp globally. For example if you installed gulp 3.9.1 globally and your project testGulp4 has gulp 4.0 installed locally, what would happen if you run gulp -v into testGulp4? Without gulp-cli globally installed : CLI version 3.9.1 In … Read more

Does a gulp task have to return anything?

If you do not return a stream, then the asynchronous result of each task will not be awaited by its caller, nor any dependent tasks. For example, when not returning streams: $ gulp scripts [21:25:05] Using gulpfile ~/my-project/gulpfile.js [21:25:05] Starting ‘tsc’… [21:25:05] Finished ‘tsc’ after 13 ms [21:25:05] Starting ‘scripts’… [21:25:05] Finished ‘scripts’ after 10 … Read more

How to inject content of CSS file into HTML in Gulp? [closed]

You could easily use gulp-replace, like so: var gulp = require(‘gulp’), replace = require(‘gulp-replace’), fs = require(‘fs’); // in your task return gulp.src(…) .pipe(replace(/<link href=”https://stackoverflow.com/questions/23820703/style.css”[^>]*>/, function(s) { var style = fs.readFileSync(“https://stackoverflow.com/questions/23820703/style.css”, ‘utf8’); return ‘<style>\n’ + style + ‘\n</style>’; })) .pipe(gulp.dest(…)); You can also easily modify the replacement RegEx to work with different files, too. return … Read more

Gulp condition inside pipe

Use the gulp-if plugin: var gulpif = require(‘gulp-if’); g.task(‘sass’, function() { return g.src(sources.sass) .pipe(changed(output.css)) .pipe(sass({style:’compressed’, sourcemap:true})) // Conditional output .pipe(gulpif(condition1, g.dest(output.css))) .pipe(gulpif(condition2, g.dest(output.css2))) .pipe(notify(‘scss converted to css and compressed <%= file.relative %>’)); });