How to use the sass.types function in sass

To help you get started, we’ve selected a few 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 igoradamenko / awsm.css / gulpfile.js View on Github external
'theme-color($name)': name => {
                name = name.getValue();

                if (!colors[name]) {
                  throw new Error(`There is no such color as ${name}`);
                }

                return new sassCompiler.types.Color(...colors[name]);
              },
              'get-version()': () => {
github mediocre / electricity / lib / index.js View on Github external
options.sass.functions['image-url($img)'] = function(img) {
        return new sass.types.String('url("' +
            (options.sass.imagePath ?
                path.join('/', options.sass.imagePath, img.getValue()) :
                path.join('/', img.getValue())
            ) +
            '")');
    };
github cliqz-oss / browser-core / broccoli / modules / sass-tree.js View on Github external
            'cdnUrl($path)': _path => new sass.types.String(`url(${CDN_BASEURL}/${_path.getValue()})`),
          },
github absolunet / nwayo / packages / workflow / ressources / dart-sass-functions.js View on Github external
custom[`${PREFIX}-file-exists($file)`] = (parameterFile) => {
	const file = parameterFile.getValue();

	return fss.exists(file) ? sass.types.Boolean.TRUE : sass.types.Boolean.FALSE;
};
github igoradamenko / awsm.css / gulpfile.js View on Github external
'get-version()': () => {
                return new sassCompiler.types.String(require('./package').version.toString());
              },
            },
github absolunet / nwayo / packages / workflow / ressources / dart-sass-functions.js View on Github external
custom[`${PREFIX}-inline-file($file)`] = (parameterFile) => {
	const file = parameterFile.getValue();

	if (fss.exists(file)) {
		const data     = fss.readFile(file).toString('base64');
		const mimeType = mimeTypes.lookup(file);

		return new sass.types.String(`url('data:${mimeType};base64,${data}')`);
	}

	throw new Error(`File '${file}' not found`);
};
github absolunet / nwayo / ressources / docs-builder / build.js View on Github external
'docsdart-read-file($file)': (parametersFile) => {
				const file = parametersFile.getValue();

				if (fss.exists(file)) {
					return new sass.types.String(fss.readFile(file, 'utf8'));
				}

				throw new Error(`File '${file}' not found`);
			}
		}