-
Notifications
You must be signed in to change notification settings - Fork 28
Integrating Skeleton Sass into Dev Workflows
Dennis Thompson edited this page Sep 10, 2017
·
8 revisions
Guides on how to consume Skeleton Sass with various workflows.
Gulp is a workflow automation plugin powered by Node.js streams and a great alternative to other workflows like Grunt.
-
Setting up Gulp
cd path/to/my_project npm init -y npm add gulp gulp-sass gulp-sourcemaps skeleton-sass-official --save-dev
-
Now that we have
gulp
and the plugin we need to compilesass
tocss
we're ready to begin writing ourgulpfile.js
:touch gulpfile.js
const path = require('path'); const gulp = require('gulp'); const sass = require('gulp-sass'); const sourcemaps = require('gulp-sourcemaps'); const SKELETON_SASS_PATH = path.join(__dirname, 'node_modules/skeleton-sass-official/skeleton/**/*');
We can copy Skeleton Sass from
node_modules
if the path string is too long (i.e. Windows is complaining) by creating a simplecopy
task:gulp.task('copy', function () { return gulp.src(SKELETON_SASS_PATH) .pipe(gulp.dest('source/tpls/skeleton-sass')); });
Next we need to create our
build
task that will compile ourscss
source intocss
:gulp.task('build:sass', function () { return gulp.src('source/sass/**/*') .pipe(sourcemaps.init()) .pipe(sass().on('error', sass.logError)) .pipe(sourcemaps.write()) .pipe(gulp.dest('target')); });
-
Create
skeleton.scss
source file From here we create ourskeleton.scss
source file:// Use ../../node_modules/skeleton-sass-official/skeleton/ instead of // ../tpls/skeleton-sass if you DID NOT use the copy task // Skeleton Sass Core Config @import "../tpls/skeleton-sass/core/config"; // Import normalize.css for theme dependency @import "../../node_modules/normalize-scss/sass/normalize/import-now"; // Skeleton Sass Theme Partials @import "../tpls/skeleton-sass/themes/fresh/vars"; @import "../tpls/skeleton-sass/themes/fresh/include_components"; @import "../tpls/skeleton-sass/themes/fresh/grid"; // Import everything else below this line...
-
Build We're ready to build!
gulp build:sass
After executing this command we should see a new
target
directory that contains our compiledsass
source