在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ahaurw01/gulp-remember开源软件地址(OpenSource Url):https://github.com/ahaurw01/gulp-remember开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-remember
var remember = require('gulp-remember'); UsageThis example shows a scenario in which you want to wrap all script files in some type of module system, then concatenate into one As long as your other plugins can keep up, this example showcases the Holy Grail of Build Tools™ - the ability to build once, var gulp = require('gulp'),
header = require('gulp-header'),
footer = require('gulp-footer'),
concat = require('gulp-concat'),
cache = require('gulp-cached'),
remember = require('gulp-remember');
var scriptsGlob = 'src/**/*.js';
gulp.task('scripts', function () {
return gulp.src(scriptsGlob)
.pipe(cache('scripts')) // only pass through changed files
.pipe(header('(function () {')) // do special things to the changed files...
.pipe(footer('})();')) // for example, add a stupid-simple module wrap to each file
.pipe(remember('scripts')) // add back all files to the stream
.pipe(concat('app.js')) // do things that require all files
.pipe(gulp.dest('public/'))
});
gulp.task('watch', function () {
var watcher = gulp.watch(scriptsGlob, ['scripts']); // watch the same files in our scripts task
watcher.on('change', function (event) {
if (event.type === 'deleted') { // if a file is deleted, forget about it
delete cache.caches['scripts'][event.path];
remember.forget('scripts', event.path);
}
});
}); APIremember(name)Returns a stream ready to remember files. name (optional)Type: The name of a specific cache you want to use. You may want to You can choose not to pass any name if you only care about caching one set of files in your whole build. remember.forget(name, path)Drops a file from a remember cache. name (optional)Type: The name of the remember cache on which you want to operate. You do not need to pass this if you want to operate on the default remember cache. Note: If the name does not refer to a cache that exists, a warning is logged. Thanks to @jcppman for this. path (required)Type: The path of the file you wish to drop from the remember cache. The path is used under the covers as the unique identifier for the file within one remember cache. Important note! The path you pass to If you want to Another note: If the path does not match a file object that exists in the given cache, a warning is logged. Thanks to @jcppman for this. remember.forgetAll(name)Drops all files from a remember cache. name (optional)Type: The name of the remember cache you want to wipe. You do not need to pass this if you want to operate on the default remember cache. Note: If the name does not refer to a cache that exists, a warning is logged. remember.cacheFor(name)Get a raw remember cache. This can be useful for checking state of the cache, like whether or not a file has been seen before. Note: Remembering or forgetting files by interacting directly with this returned object is not recommended. name (optional)Type: The name of the remember cache you want to retrieve. You do not need to pass this if you want to retrieve the default remember cache. GotchasForgetting files with altered pathsSee the API note above for the Thanks to @brian-mann for bringing this up. File orderingBe aware that this plugin does not make specific attempts to keep your files in any order. For example, if you add a new file governed by a glob you are watching, this file will enter the stream last, even if this file would preceed others alphabetically. If your build process depends on file ordering, please make use of the gulp-order plugin after Thanks to @brian-mann for bringing this up. Files do not change in the cacheFiles are Thanks to @mjancarik for this addition. License(MIT License) Copyright (c) 2014 Aaron Haurwitz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论