他们之间的区别是什么?
gulp.src(imgSrc)
.pipe(newer(imgDest))
.pipe(imagemin())
.pipe(gulp.dest(imgDest));
Run Code Online (Sandbox Code Playgroud)
gulp.src(SRC)
.pipe(changed(DEST))
// ngmin will only get the files that
// changed since the last time it was run
.pipe(ngmin())
.pipe(gulp.dest(DEST));
Run Code Online (Sandbox Code Playgroud)
看来gulp-change更强大,因为它提供了一个选项
hasChanged: changed.compareLastModifiedTime
Run Code Online (Sandbox Code Playgroud) gulp.task('usemin', function () {
return gulp.src(path.src + '*.html')
.pipe(usemin({
assetsDir: 'src',
css: [ minifyCss(), 'concat', rev()],
js: [uglify(), rev()],
images: [rev()]
}))
.pipe(gulp.dest(path.dist));
});
Run Code Online (Sandbox Code Playgroud)
它不适用于图像.
<input type="file" accept="image/png">
Run Code Online (Sandbox Code Playgroud)
预计文件对话框仅接受png文件.但是accept="image/png"在Firefox上不起作用.我该怎么做?PS适用于Chrome.
-f, --show-name
Show the filename in the original commit. By default the filename is shown if there is any line that came from a file with a different name, due to rename detection.
Run Code Online (Sandbox Code Playgroud)
但是--show-name=off不起作用.
error: option `show-name' takes no value
usage: git blame [<options>] [<rev-opts>] [<rev>] [--] <file>
Run Code Online (Sandbox Code Playgroud)
如何从输出中隐藏详细文件名?
码
import * as React from 'react';
import * as PropTypes from 'prop-types';
interface ILayoutProps {
dir?: 'horizontal' | 'vertical'
};
const Layout: React.FunctionComponent<ILayoutProps> = (props) => {
return (
<div>
{props.children}
</div>
);
};
Layout.defaultProps = {
dir: 'horizontal'
};
Layout.propTypes = {
dir: PropTypes.oneOf(['horizontal', 'vertical'])
};
export default Layout;
Run Code Online (Sandbox Code Playgroud)
错误信息
TS2322: Type '{ dir: Requireable<string>; }' is not assignable to type 'ValidationMap<ILayoutProps>'.
Types of property 'dir' are incompatible.
Type 'Requireable<string>' is not assignable to type 'Validator<"horizontal" | "vertical" …Run Code Online (Sandbox Code Playgroud) // Found this seed-based random generator somewhere
// Based on The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
var seed = 1;
/**
* return a random number based on a seed
* @param seed
* @returns {number}
*/
function getNextValue() {
seed = (seed * 9301 + 49297) % 233280;
return seed/(233280.0);
}
function setSeed(_seed_) {
seed = _seed_;
}
module.exports = {
nextValue: getNextValue,
seed: setSeed
};Run Code Online (Sandbox Code Playgroud)
见https://github.com/dylang/shortid/blob/master/lib/random/random-from-seed.js