Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thabotitus committed Jul 14, 2020
1 parent a16613f commit 4ca8d18
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ gulp.task(
gulp.task(
'bump:patch',
function() {
return gulp.src(source).pipe(bump({type:'patch'})).pipe(gulp.dest(ROOT));
return gulp.src(source).pipe(bump({ type:'patch' })).pipe(gulp.dest(ROOT));
});
2 changes: 2 additions & 0 deletions build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const DISTRIBUTION_FOLDERS = {
IMAGES: 'img',
ROOT: 'docs',
JS: 'js',
DATA: 'data',
PAGES: 'pages'
}

const INPUT_FOLDERS = {
Expand Down
7 changes: 2 additions & 5 deletions build/data.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict'
import gulp from 'gulp';

const DIST_FOLDERS = {
ROOT: 'docs',
};
import { DISTRIBUTION_FOLDERS } from './config.js';

gulp.task('build:copy_data', () => {
return gulp.src('./src/data/**/*')
.pipe(gulp.dest(`./${DIST_FOLDERS.ROOT}/data`));
.pipe(gulp.dest(`./${DISTRIBUTION_FOLDERS.ROOT}/${DISTRIBUTION_FOLDERS.DATA}`));
});

14 changes: 6 additions & 8 deletions build/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ import gulp from 'gulp';
import browserSync from 'browser-sync';
import nunjucksRender from 'gulp-nunjucks-render';
const browser = browserSync.create();
import { DISTRIBUTION_FOLDERS } from './config.js';

const DIST_FOLDERS = {
ROOT: 'docs',
};

const TEMPLATES_PATH = 'src/templates';

gulp.task('build:html_pages', function() {
return gulp.src(['src/pages/**/*.njk'])
.pipe(nunjucksRender({
path: ['src/templates']
path: [TEMPLATES_PATH]
}))
.pipe(gulp.dest(`${DIST_FOLDERS.ROOT}/pages`))
.pipe(gulp.dest(`${DISTRIBUTION_FOLDERS.ROOT}/${DISTRIBUTION_FOLDERS.PAGES}`))
.pipe(browserSync.stream());
});

gulp.task('build:html_index', function() {
return gulp.src(['src/index.njk'])
.pipe(nunjucksRender({
path: ['src/templates']
path: [TEMPLATES_PATH]
}))
.pipe(gulp.dest(`${DIST_FOLDERS.ROOT}`))
.pipe(gulp.dest(`${DISTRIBUTION_FOLDERS.ROOT}`))
.pipe(browser.stream());
});
16 changes: 4 additions & 12 deletions build/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@ import browserSync from 'browser-sync';
const browser = browserSync.create();
import imageMin from 'gulp-imagemin';

const DIST_FOLDERS = {
IMAGES: 'img',
ROOT: 'docs',
};

const INPUT_FOLDERS = {
IMAGES: './src/img',
ROOT: './src',
};
import { DISTRIBUTION_FOLDERS, INPUT_FOLDERS } from './config.js';

gulp.task(
'build:images',
Expand All @@ -22,10 +14,10 @@ gulp.task(
.pipe(plumber())
.pipe(imageMin({
progressive: true,
interlaced: true,
pngquant: true,
interlaced: true,
pngquant: true,
verbose: true,
}))
.pipe(gulp.dest(`./${DIST_FOLDERS.ROOT}/${DIST_FOLDERS.IMAGES}`))
.pipe(gulp.dest(`./${DISTRIBUTION_FOLDERS.ROOT}/${DISTRIBUTION_FOLDERS.IMAGES}`))
.pipe(browser.stream())
});
18 changes: 3 additions & 15 deletions build/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,9 @@ const browser = browserSync.create();

const OUTPUT_FILE_NAME = 'jca-ui-kit.min.css';

const DIST_FOLDERS = {
CSS: 'css',
ROOT: 'docs',
};
import { DISTRIBUTION_FOLDERS, INPUT_FOLDERS } from './config.js';

const INPUT_FOLDERS = {
CSS: './src/styles',
ROOT: './src',
};

const BUILD_STYLES = gulp.task(
gulp.task(
'build:styles',
function(){
return gulp.src([`${INPUT_FOLDERS.CSS}/**/*.scss`])
Expand All @@ -50,10 +42,6 @@ const BUILD_STYLES = gulp.task(
}))
.pipe(sourcemaps.write())
.pipe(concat(OUTPUT_FILE_NAME))
.pipe(gulp.dest(`./${DIST_FOLDERS.ROOT}/${DIST_FOLDERS.CSS}`))
.pipe(gulp.dest(`./${DISTRIBUTION_FOLDERS.ROOT}/${DISTRIBUTION_FOLDERS.CSS}`))
.pipe(browser.stream())
});

export {
BUILD_STYLES
};
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "gulp serve",
"build": "gulp"
"build": "gulp",
"bump:patch": "gulp bump:patch",
"bump:minor": "gulp bump:minor",
"bump:major": "gulp bump:major"
},
"keywords": [
"SASS",
Expand Down

0 comments on commit 4ca8d18

Please sign in to comment.