在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mason-stewart/gulp-directory-map开源软件地址(OpenSource Url):https://github.com/mason-stewart/gulp-directory-map开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-directory-map
UsageFirst, install npm install --save-dev gulp-directory-map Then, add it to your var directoryMap = require("gulp-directory-map");
gulp.src('app/**/*.html')
.pipe(directoryMap({
filename: 'urls.json'
}))
.pipe(gulp.dest('dist')); Given this directory structure...
... this JSON object would be written to {
"index.html": "index.html",
"nested-folder-1": {
"faq.html": "nested-folder-1/faq.html",
"index.html": "nested-folder-1/index.html",
"nested-folder-1-1": {
"index.html": "nested-folder-1/nested-folder-1-1/index.html"
}
},
"nested-folder-2": {
"index.html": "nested-folder-2/index.html"
}
} This is useful for mapping out a directory structure after passing files through a pre-processor, generating data to create navigation during build, and more. Have fun! APIdirectory-map(options)options.filenameType: The path to write the directory structure JSON file to. options.prefixType: The a string to prepend to every url. Given the directory structure above, specifiying {
"prefixed-folder": {
"index.html": "prefixed-folder/index.html",
"nested-folder-1": {
"faq.html": "prefixed-folder/nested-folder-1/faq.html",
"index.html": "prefixed-folder/nested-folder-1/index.html",
"nested-folder-1-1": {
"index.html": "prefixed-folder/nested-folder-1/nested-folder-1-1/index.html"
}
},
"nested-folder-2": {
"index.html": "prefixed-folder/nested-folder-2/index.html"
}
}
} LicenseThanksThanks to @hparra for creating the generator-gulp-plugin. It has lots of great examples and boilerplate setup, and was used to get this plugin bootstrapped. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论