-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt handlebars precompiled templates (#1752)
* Adopt handlebars precompiled templates * Included gulp-concat / declare in dev dependencies * replace empty to null formatter * Added gulp to run before executing unit tests * travis build changes * changes to appveyor build
- Loading branch information
1 parent
fe8adfa
commit 3649322
Showing
16 changed files
with
226 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2017 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
const gulp = require('gulp'); | ||
const handlebars = require('gulp-handlebars'); | ||
const declare = require('gulp-declare'); | ||
const concat = require('gulp-concat'); | ||
const config = require('./config'); | ||
|
||
module.exports = { | ||
compilePartials, | ||
compileReport | ||
}; | ||
|
||
function compilePartials() { | ||
compile(config.partials, config.partialsDist, 'partials'); | ||
} | ||
|
||
function compileReport() { | ||
compile(config.report, config.reportDist, 'templates'); | ||
} | ||
|
||
function compile(location, dist, type) { | ||
return gulp.src(location) | ||
.pipe(handlebars({ | ||
handlebars: require('handlebars') | ||
})) | ||
.pipe(declare({ | ||
namespace: `report.${type}`, | ||
noRedeclare: true, // Avoid duplicate declarations | ||
})) | ||
.pipe(concat(`report-${type}.js`)) | ||
.pipe(gulp.dest(dist)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright 2017 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
module.exports = { | ||
report: 'lighthouse-core/**/templates/*.html', | ||
reportDist: 'lighthouse-core/report/templates/', | ||
partials: 'lighthouse-core/formatters/partials/*.html', | ||
partialsDist: 'lighthouse-core/formatters/partials/templates/', | ||
dist: 'dist' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright 2017 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
const gulp = require('gulp'); | ||
const compile = require('./gulp/compile'); | ||
const config = require('./gulp/config'); | ||
|
||
gulp.task('compileReport', compile.compileReport); | ||
gulp.task('compilePartials', compile.compilePartials); | ||
|
||
gulp.task('compile-templates', ['compileReport', 'compilePartials']); | ||
|
||
gulp.task('watch', ['compileReport', 'compilePartials'], () => { | ||
gulp.watch([ | ||
config.report | ||
], ['compileReport']); | ||
|
||
gulp.watch([ | ||
config.partials | ||
], ['compilePartials']); | ||
}); | ||
|
||
gulp.task('default', ['compile-templates']); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.