Giter Club home page Giter Club logo

gulp-sass-partials-imported's Introduction

gulp-sass-partials-imported Build Status

It process scss partials files and add the files that import them to the pipe.

Use it with gulp-cached and gulp-sass to create a watch task that avoid the re-compile of all the scss files in the project everytime you save one of them, saving a lot of time.

Install

$ npm install --save-dev gulp-sass-partials-imported

Usage

Just add sassPartialsImported to the pipe

.pipe( sassPartialsImported(scss_dir, includePaths) )

Arguments

scss_dir (string) [required]

Folder where all the scss files are

includePaths (string|Array) [optional]

Path string, or Array of paths, where look in to attempt to resolve your @import declarations. (same as includePaths of node-sass)

Example

In the example below we have a watch task that, everytime we save a partial file, adds to the pipe all the scss files that @import the partial file.

const gulp = require('gulp'),
const sass = require('gulp-sass');
const cached = require('gulp-cached');
const sassPartialsImported = require('gulp-sass-partials-imported');

let scss_dir = 'src/scss/';
let includePaths = ['src/scss/vendors'];

gulp.task('sass', () => {
	gulp.src('src/*.scss')
		.pipe(cached('sassfiles'))
		.pipe(sassPartialsImported(scss_dir, includePaths))
		.pipe(sass({ includePaths: scss_dir }).on('error', sass.logError))
		.pipe(gulp.dest('dist'));
});


gulp.task('watch', function () {

    gulp.watch('src/*.scss', ['sass'])

});

License

MIT © G100g(http://g100g.net) - Davide Cantelli (http://ww.davidecantelli.it)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.