Skip to content

Commit

Permalink
build(css): use sass
Browse files Browse the repository at this point in the history
  • Loading branch information
vltansky committed Jun 26, 2020
1 parent c3189a6 commit f1ec7ad
Show file tree
Hide file tree
Showing 6 changed files with 1,262 additions and 115 deletions.
1 change: 1 addition & 0 deletions dist/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,4 @@ textarea {
}
}


3 changes: 3 additions & 0 deletions dist/scss/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*! HTML5 Boilerplate v8.0.0 | MIT License | https://html5boilerplate.com/ */

@import "~main.css/dist/main.css";
39 changes: 33 additions & 6 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ import modernizr from 'modernizr';

import pkg from './package.json';
import modernizrConfig from './modernizr-config.json';
import sass from 'gulp-sass';
import cssImport from 'gulp-cssimport';

const dirs = pkg['h5bp-configs'].directories;

// ---------------------------------------------------------------------
// | Helper tasks |
// ---------------------------------------------------------------------


const tildeImporter = (url, prev, done) => {
if (url[0] === '~') {
url = path.resolve('node_modules', url.substr(1));
}

return { file: url };
}

gulp.task('archive:create_archive_dir', (done) => {
fs.mkdirSync(path.resolve(dirs.archive), '0755');
done();
Expand Down Expand Up @@ -96,14 +107,29 @@ gulp.task('copy:license', () =>
gulp.task('copy:main.css', () => {
const banner = `/*! HTML5 Boilerplate v${pkg.version} | ${pkg.license} License | ${pkg.homepage} */\n\n`;

return gulp.src('node_modules/main.css/dist/main.css')
return gulp.src(`${dirs.src}/css/*.scss`)
.pipe(plugins().header(banner))
.pipe(plugins().autoprefixer({
cascade: false
}))
.pipe(gulp.dest(`${dirs.dist}/css`));
.pipe(gulp.dest(`${dirs.dist}/scss`));
});
gulp.task('build:main.css', () => {
const banner = `/*! HTML5 Boilerplate v${pkg.version} | ${pkg.license} License | ${pkg.homepage} */\n\n`;
return gulp.src(`${dirs.src}/css/*.scss`)
.pipe(
sass({
// outputStyle: 'compact',
importer: tildeImporter,
includePaths: [
'node_modules', 'bower_components', 'src', '.'
]
}).on('error', sass.logError)
)
.pipe(cssImport())
.pipe(plugins().header(banner))
.pipe(plugins().autoprefixer({
cascade: false
}))
.pipe(gulp.dest(`${dirs.dist}/css`));
});

gulp.task('copy:misc', () =>
gulp.src([
// Copy all files
Expand Down Expand Up @@ -153,6 +179,7 @@ gulp.task(
'copy:index.html',
'copy:license',
'copy:main.css',
'build:main.css',
'copy:misc',
'copy:normalize'
)
Expand Down
Loading

0 comments on commit f1ec7ad

Please sign in to comment.