本文整理汇总了TypeScript中node-sass.renderSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript renderSync函数的具体用法?TypeScript renderSync怎么用?TypeScript renderSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了renderSync函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test(`It should import only specific custom nodes.`, () => {
const expectedResult = fs.readFileSync(`test/files/filter-import-custom.css`, {
encoding: `utf8`,
});
const options = {
customFilters: {
customMediaWidth: [
[
{ property: `type`, value: `atrule` },
{ property: `name`, value: `media` },
{ property: `params`, value: `(min-width: 42em)` },
],
],
customMediaPrint: [
[
{ property: `type`, value: `atrule` },
{ property: `name`, value: `media` },
{ property: `params`, value: `print` },
],
],
},
};
const result = sass.renderSync({
file: `test/files/filter-import-custom.scss`,
importer: magicImporter(options) as any,
}).css.toString();
expect(result).toBe(expectedResult);
});
开发者ID:maoberlehner,项目名称:node-sass-magic-importer,代码行数:30,代码来源:magic-importer.test.ts
示例2: compile
exports.compile = function compile(buffer, stream) {
stream.write(sass.renderSync({
data: buffer,
error: function (e) {
throw new Error(e);
}
}));
};
开发者ID:jspdown,项目名称:webkool,代码行数:8,代码来源:sass.ts
示例3: Buffer
Config.transformStyle = (source: string, url: string, d: Decorator) => {
const res = sass.renderSync({
sourceMap: true, data: source, sourceMapEmbed: true
});
const code = res.css.toString();
const base64Map = code.match(/\/\*(.*?)\*\//)[1].replace('# sourceMappingURL=data:application/json;base64,', '');
const map = JSON.parse(new Buffer(base64Map, 'base64').toString('ascii'));
return { code, source, map };
};
开发者ID:SteveVanOpstal,项目名称:codelyzer,代码行数:9,代码来源:noUnusedCssRule.spec.ts
示例4: test
test(`Should not fail when dir is empty.`, () => {
const expectedResult = ``;
const result = sass.renderSync({
file: `test/files/glob-import-empty-dir.scss`,
importer: globImporter(),
}).css.toString();
expect(result).toBe(expectedResult);
});
开发者ID:maoberlehner,项目名称:node-sass-magic-importer,代码行数:10,代码来源:glob-importer.test.ts
示例5: test
test(`It should import only specific nodes.`, () => {
const expectedResult = fs.readFileSync(`test/files/filter-import.css`, {
encoding: `utf8`,
});
const result = sass.renderSync({
file: `test/files/filter-import.scss`,
importer: filterImporter(),
}).css.toString();
expect(result).toBe(expectedResult);
});
开发者ID:maoberlehner,项目名称:node-sass-magic-importer,代码行数:12,代码来源:filter-importer.test.ts
示例6: _compileSCSS
/**
* Compiles SCSS to CSS and passes it through Autoprefixer.
*/
static _compileSCSS(styles: string): string {
let compiled = sass.renderSync({
data: styles,
outputStyle: 'compressed'
}).css.toString();
let prefixer = autoprefixer({
browsers: ['last 2 versions', 'last 4 Android versions']
});
return postcss(prefixer).process(compiled).css;
}
开发者ID:angular,项目名称:material-tools,代码行数:16,代码来源:CSSBuilder.ts
示例7: test
test(`It should import files from modules.`, () => {
const expectedResult = fs.readFileSync(`test/files/package-import.css`, {
encoding: `utf8`,
});
const result = sass.renderSync({
file: `test/files/package-import.scss`,
importer: packageImporter({
cwd: `${__dirname}/files`,
}),
}).css.toString();
expect(result).toBe(expectedResult);
});
开发者ID:maoberlehner,项目名称:node-sass-magic-importer,代码行数:13,代码来源:package-importer.test.ts
注:本文中的node-sass.renderSync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论