Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request #131 from OfficeDev/leddie24/add-comments-to-js-he…
Browse files Browse the repository at this point in the history
…ader

add version number to JS/CSS and component files
  • Loading branch information
leddie24 authored Sep 27, 2016
2 parents 4422431 + 5da65f0 commit fa2d27d
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
7 changes: 5 additions & 2 deletions gulp/ComponentJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,21 @@ gulp.task('ComponentJS-typescript', ['Documentation-template'], function() {

// place .d.ts outqput in both the Samples folder and the Components folder
tscResult.dts.pipe(Plugins.concat("fabric.d.ts"))
.pipe(Plugins.header(Banners.getJSCopyRight()))
.pipe(Plugins.header(Banners.getBannerTemplate(), Banners.getBannerData()))
.pipe(Plugins.header(Banners.getJSCopyRight(), Banners.getBannerData()))
.pipe(gulp.dest(Config.paths.distJS))
.pipe(Plugins.gulpif(Config.debugMode, Plugins.debug({
title: "Output Fabric Component .d.ts built from TypeScript"
}))),

// place .js output in both the Samples folder and the Components folder
tscResult.js.pipe(Plugins.concat("fabric.js"))
.pipe(Plugins.header(Banners.getJSCopyRight()))
.pipe(Plugins.header(Banners.getBannerTemplate(), Banners.getBannerData()))
.pipe(gulp.dest(Config.paths.distJS))
.pipe(Plugins.uglify())
.pipe(Plugins.rename('fabric.min.js'))
.pipe(Plugins.header(Banners.getBannerTemplate(), Banners.getBannerData()))
.pipe(Plugins.header(Banners.getJSCopyRight(), Banners.getBannerData()))
.pipe(gulp.dest(Config.paths.distJS))
.pipe(Plugins.gulpif(Config.debugMode, Plugins.debug({
title: "Output Fabric Component .d.ts built from TypeScript"
Expand Down
9 changes: 9 additions & 0 deletions gulp/Documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ gulp.task('Documentation-handlebars', function(cb) {
gulp.task('Documentation-template', ["Documentation-handlebars"], function(cb) {
var _template = new Template(folderList, Config.paths.distJS, Config.paths.componentsPath, function() {
gulp.src(Config.paths.distJS + "/fabric.templates.ts")
.pipe(Plugins.header(Banners.getBannerTemplate(), Banners.getBannerData()))
.pipe(Plugins.header(Banners.getJSCopyRight()))
.pipe(Plugins.tsc(Config.typescriptProject))
.js.pipe(gulp.dest(Config.paths.distJS))
Expand All @@ -99,6 +100,13 @@ gulp.task('Documentation-template', ["Documentation-handlebars"], function(cb) {
_template.init();
});

gulp.task('Documentation-templateAddHeader', ['Documentation-template'], function(){
gulp.src(Config.paths.distJS + "/fabric.templates.ts")
.pipe(Plugins.header(Banners.getBannerTemplate(), Banners.getBannerData()))
.pipe(Plugins.header(Banners.getJSCopyRight()))
.pipe(gulp.dest(Config.paths.distJS));
});

//
// Sample Component Building
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -270,6 +278,7 @@ var DocumentationTasks = [
'ComponentJS',
'Documentation-copyIgnoredFiles',
"Documentation-template",
"Documentation-templateAddHeader",
"Documentation-buildStyles",
"Documentation-convertMarkdown"
];
Expand Down
30 changes: 29 additions & 1 deletion gulp/FabricComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ gulp.task('FabricComponents-nuke', function () {

gulp.task('FabricComponents-copyAssets', function () {
// Copy all Components files.
return gulp.src([Config.paths.componentsPath + '/**', '!' + Config.paths.componentsPath + '/**/*.js', '!' + Config.paths.componentsPath + '/**/*.ts'])
return gulp.src([Config.paths.componentsPath + '/**/*.json',
'!' + Config.paths.componentsPath + '/**/*.js',
'!' + Config.paths.componentsPath + '/**/*.ts',
'!' + Config.paths.componentsPath + '/**/*.hbs',
'!' + Config.paths.componentsPath + '/**/*.scss'])
.pipe(Plugins.plumber(ErrorHandling.onErrorInPipe))
.pipe(Plugins.changed(Config.paths.distComponents))
.pipe(Plugins.gulpif(Config.debugMode, Plugins.debug({
Expand All @@ -44,6 +48,28 @@ gulp.task('FabricCoreStyles-copyAssets', function() {
.pipe(gulp.dest(Config.paths.distCSS));
});

//
// Add Comments to Component Files (HBS and SCSS) and copy to Dist/Components
// ----------------------------------------------------------------------------

gulp.task('FabricComponents-addCommentsToComponentsHBS', ['FabricComponents-copyAssets'], function(){
return gulp.src(Config.paths.componentsPath + '/**/' + '*.hbs')
.pipe(Plugins.debug({
title: "Adding Comments to Component HBS"
}))
.pipe(Plugins.header(Banners.getBannerTemplateHTML(), Banners.getBannerData()))
.pipe(gulp.dest(Config.paths.distComponents));
});

gulp.task('FabricComponents-addCommentsToComponentsSCSS', ['FabricComponents-copyAssets'], function(){
return gulp.src(Config.paths.componentsPath + '/**/' + '*.scss')
.pipe(Plugins.debug({
title: "Adding Comments to Component SASS"
}))
.pipe(Plugins.header(Banners.getBannerTemplate(), Banners.getBannerData()))
.pipe(gulp.dest(Config.paths.distComponents));
});


//
// Sass tasks
Expand Down Expand Up @@ -102,6 +128,8 @@ gulp.task('FabricComponents', [
'FabricComponents-buildAndCombineStyles',
'FabricComponents-copyAssets',
'FabricCoreStyles-copyAssets',
'FabricComponents-addCommentsToComponentsHBS',
'FabricComponents-addCommentsToComponentsSCSS',
'ComponentJS'
]
);
Expand Down
11 changes: 11 additions & 0 deletions gulp/modules/Banners.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ var Banners = function() {
' **/',
''].join('\n');
};
/**
* Retrieve Banner Template with Template Variables
* @returns {String} with template variables for pkg version and pkg description
*/
this.getBannerTemplateHTML = function() {
return ['<!--',
'Office UI Fabric JS <%= pkg.version %>',
'<%= pkg.description %>',
'-->',
''].join('\n');
};
/**
* Retrieve Copyright Comment for Javascript
* @returns {String} containing Javascript Comment Speicific Copyright Message
Expand Down

0 comments on commit fa2d27d

Please sign in to comment.