Use ejs to build SpecRunner.html
This commit is contained in:
@@ -3,17 +3,23 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const archiver = require('archiver');
|
const archiver = require('archiver');
|
||||||
const glob = require('glob');
|
const glob = require('glob');
|
||||||
|
const ejs = require('ejs');
|
||||||
|
|
||||||
function standaloneTmpDir(path) { return "dist/tmp/" + path; }
|
function standaloneTmpDir(path) { return "dist/tmp/" + path; }
|
||||||
|
|
||||||
grunt.registerTask("build:compileSpecRunner",
|
grunt.registerTask("build:compileSpecRunner",
|
||||||
"Processes the spec runner template and writes to a tmp file",
|
"Processes the spec runner template and writes to a tmp file",
|
||||||
function() {
|
function() {
|
||||||
var runnerHtml = grunt.template.process(
|
const template = fs.readFileSync('grunt/templates/SpecRunner.html.ejs',
|
||||||
grunt.file.read("grunt/templates/SpecRunner.html.jst"),
|
{encoding: 'utf8'});
|
||||||
{ data: { jasmineVersion: global.jasmineVersion }});
|
const runnerHtml = ejs.render(template, { jasmineVersion: global.jasmineVersion });
|
||||||
|
|
||||||
grunt.file.write(standaloneTmpDir("SpecRunner.html"), runnerHtml);
|
if (!fs.existsSync('dist/tmp')) {
|
||||||
|
fs.mkdirSync('dist/tmp');
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync('dist/tmp/SpecRunner.html', runnerHtml,
|
||||||
|
{encoding: 'utf8'});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user