Skip to content

Commit

Permalink
fix(ngx-auth-firebaseui): updated gulp script to copy the assets dir
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Apr 6, 2018
1 parent 11ea43d commit 0f3bdcf
Show file tree
Hide file tree
Showing 3 changed files with 2,235 additions and 136 deletions.
33 changes: 29 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const gulp = require('gulp');
const gulpUtil = require('gulp-util');
const helpers = require('./config/helpers');
const isDocker = require('is-docker');
const imagemin = require('gulp-imagemin'),
gif = require('imagemin-gifsicle'),
jpg = require('imagemin-jpegoptim'),
png = require('imagemin-optipng'),
svg = require('imagemin-svgo');

/** TSLint checker */
const tslint = require('tslint');
Expand Down Expand Up @@ -80,6 +85,7 @@ const config = {
allTs: 'src/**/!(*.spec).ts',
allSass: 'src/**/*.+(scss|sass)',
allHtml: 'src/**/*.html',
assets: 'src/module/assets/**/*',
demoDir: 'demo/',
buildDir: 'tmp/',
outputDir: 'dist/',
Expand Down Expand Up @@ -303,7 +309,7 @@ gulp.task('build:watch-fast', ['build-watch-no-tests'], () => {
/////////////////////////////////////////////////////////////////////////////

// Prepare 'dist' folder for publication to NPM
gulp.task('npm-package', (cb) => {
gulp.task('npm-package', ['copy:assets'], (cb) => {
let pkgJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
let targetPkgJson = {};
let fieldsToCopy = ['version', 'description', 'keywords', 'author', 'repository', 'license', 'bugs', 'homepage'];
Expand All @@ -330,9 +336,11 @@ gulp.task('npm-package', (cb) => {
// copy the needed additional files in the 'dist' folder
pump(
[
gulp.src(['README.md', 'LICENSE', 'CHANGELOG.md',
`${config.buildDir}/lib-es5/**/*.d.ts`,
`${config.buildDir}/lib-es5/**/*.metadata.json`]),
gulp.src(
['README.md', 'LICENSE', 'CHANGELOG.md',
`${config.buildDir}/lib-es5/**/*.d.ts`,
`${config.buildDir}/lib-es5/**/*.metadata.json`,
]),
gulpFile('package.json', JSON.stringify(targetPkgJson, null, 2)),
gulp.dest(config.outputDir)
], cb);
Expand Down Expand Up @@ -459,6 +467,23 @@ gulp.task('rollup-bundle', (cb) => {
});
});

/////////////////////////////////////////////////////////////////////////////
// Copy Assets - images, i18n, json files...
/////////////////////////////////////////////////////////////////////////////
gulp.task('copy:assets', () => {
gulp.src([`${config.assets}`])
.pipe(imagemin([
jpg({max: 50}),
png({optimizationLevel: 3}),
gif({optimizationLevel: 3}),
svg({
minifyStyles: true,
removeDoctype: true
})
]))
.pipe(gulp.dest(`${config.outputDir}/assets`));
});


/////////////////////////////////////////////////////////////////////////////
// Demo Tasks
Expand Down
Loading

0 comments on commit 0f3bdcf

Please sign in to comment.