本文整理匯總了TypeScript中stylus.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: compile
function compile(str: string, path: string) {
console.log(str);
console.log(path);
return stylus(str)
.set('filename', path)
.set('compress', true)
.use(nib());
}
示例2: stylus
var compile = function (str, path) {
return stylus(str)
.set('filename', path)
.use(nib());
};
示例3: stylus
compile: (str: string, path: string) => { return stylus(str).use(nib()).set("filename", path).set("compress", true); }
示例4: render
}
return { code: result.css.toString(), errors: [] }
}
}
// .styl
const styl = {
render(
source: string,
map: any | null,
options: any
): StylePreprocessorResults {
const nodeStylus = require('stylus')
try {
const ref = nodeStylus(source)
Object.keys(options).forEach(key => ref.set(key, options[key]))
if (map) ref.set('sourcemap', { inline: false, comment: false })
const result = ref.render()
if (map) {
return {
code: result,
map: merge(map, ref.sourcemap),
errors: []
}
}
return { code: result, errors: [] }
} catch (e) {
return { code: '', errors: [e] }