在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jelz/gulp-metalsmith开源软件地址(OpenSource Url):https://github.com/jelz/gulp-metalsmith开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-metalsmithAPI changes!Please note that as of v1.0.0 TutorialThis README file doesn't make sense at first glance or is too technical? See
the About
After build Installation$ npm install --save-dev gulp-metalsmith UsageThe simplest build task (just copies all files from const gulp = require('gulp');
const metalsmith = require('gulp-metalsmith');
gulp.task('metalsmith', function() {
return gulp.src('src/**')
.pipe(metalsmith())
.pipe(gulp.dest('build'));
}); All options: const gulp = require('gulp');
const metalsmith = require('gulp-metalsmith');
gulp.src('src/**').pipe(metalsmith({
// Metalsmith's root directory, for example for locating templates, defaults to CWD
root: __dirname,
// Files to exclude from the build
ignore: ['src/*.tmp'],
// Parsing frontmatter, defaults to true
frontmatter: true,
// Metalsmith plugins to use:
use: [
markdown(),
layouts({engine: 'swig'})
],
// Initial Metalsmith metadata, defaults to {}
metadata: {
site_title: 'Sample static site'
},
// List of JSON files that contain page definitions
// true means "all JSON files", see the section below
json: ['src/pages.json']
})); Use it with JSONGiven the file {
"index.html": {
"title": "Homepage",
"layout": "basic.swig",
"contents": "<p>In euismod eleifend nunc ac pretium...</p>"
},
"contact.html": {
"title": "Contact",
"layout": "basic.swig",
"contents": "<p>Lorem ipsum dolor sit amet...</p>"
}
} You can do this: gulp.src('src/**').pipe(metalsmith({
use: [layouts({engine: 'swig'})],
json: true
})); This way your Metalsmith build will contain two additional files,
AuthorJakub Elżbieciak / @jelzbieciak LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论