How to use the gulp-sass/node_modules/node-sass.types function in gulp-sass

To help you get started, we’ve selected a few gulp-sass examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fevrcoding / wok / build / gulp-tasks / lib / sass-functions.js View on Github external
*/

const path = require('path');
const fs = require('fs');
const times = require('lodash/times');
const escapeRegExp = require('lodash/escapeRegExp');
const sizeOf = require('image-size');
const datauri = require('datauri').sync;

let types;

/* eslint-disable prefer-destructuring */
try {
    types = require('node-sass').types;
} catch (e) {
    types = require('gulp-sass/node_modules/node-sass').types; //eslint-disable-line import/no-unresolved
}
/* eslint-enable prefer-destructuring */
module.exports = (options) => {

    const paths = require('../../gulp-config/paths');
    const rootPath = paths.toAbsPath('src.root');
    const imgPath = paths.toAbsPath('src.assets/images');
    const baseRegExp = new RegExp('^' + escapeRegExp(rootPath + path.sep));

    const baseUrl = '/' + paths.toAbsPath('src.assets/images').replace(baseRegExp, '').replace(path.sep, '/').trim('/') + '/';


    const getFilePath = (filepath) => {
        const imagePath = path.join(imgPath, filepath.getValue());
        if (!fs.existsSync(imagePath)) {
            console.warn('File %s not found', imagePath); //eslint-disable-line no-console

gulp-sass

Gulp plugin for sass

MIT
Latest version published 3 years ago

Package Health Score

62 / 100
Full package analysis