在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):shinnn/gulp-svelte开源软件地址(OpenSource Url):https://github.com/shinnn/gulp-svelte开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-svelteA gulp plugin to compile Svelte templates to JavaScript Installation
APIconst gulpSvelte = require('gulp-svelte'); gulpSvelte([options])options: const {dest, src, task} = require('gulp');
const gulpSvelte = require('gulp-svelte');
task('default', () => {
return src('index.html') // index.html: '<h1>Hi {{author}}.</h1>'
.pipe(gulpSvelte())
.pipe(dest('dest')); // dest/index.js: 'function create_main_fragment ( state, component ) { ...'
}); Note:
const {dest, src, task} = require('gulp');
const gulpSvelte = require('gulp-svelte');
task('default', () => {
return src('source.html') // source.html: '<style>p{color:red}</style><p>Hello</p>'
.pipe(gulpSvelte({css: false}))
.pipe(dest('dest'));
// dest/source.js: '... p = createElement("p"); p.className = "svelte-16e8uch"; ...'
// dest/source.css: 'p.svelte-16e8uch{color:red}'
}); options.preprocessType: Modify contents with const {dest, src, task} = require('gulp');
const gulpSvelte = require('gulp-svelte');
task('default', () => {
return src('index.html') // index.html: '<b>original</b>'
.pipe(gulpSvelte({
preprocess: {
markup({content}) {
return {code: content.replace('original', 'modified')}
}
}
}))
.pipe(dest('dest')); // dest/index.js: '... b = createElement("b");\n\t\t\tb.textContent = "modified"; ...'
}); LicenseISC License © 2017 - 2018 Shinnosuke Watanabe |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论