小编Fra*_*ang的帖子

gulp-newer vs gulp-changed

他们之间的区别是什么?

gulp-newer:

gulp.src(imgSrc)
  .pipe(newer(imgDest))
  .pipe(imagemin())
  .pipe(gulp.dest(imgDest));
Run Code Online (Sandbox Code Playgroud)

gulp-changed:

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)

npm gulp

45
推荐指数
2
解决办法
2万
查看次数

GulpJS:如何修改图像然后在css文件中更新它们的引用?

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)

它不适用于图像.

build gulp

12
推荐指数
1
解决办法
2764
查看次数

输入accept ="image/png"在Firefox中不起作用

jsbin

<input type="file" accept="image/png">
Run Code Online (Sandbox Code Playgroud)

预计文件对话框仅接受png文件.但是accept="image/png"在Firefox上不起作用.我该怎么做?PS适用于Chrome.

html javascript firefox html5

10
推荐指数
1
解决办法
8767
查看次数

如何在git blame时抑制--show-name(filename)选项?

-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)

如何从输出中隐藏详细文件名?

git

10
推荐指数
3
解决办法
1273
查看次数

类型'Requireable <string>'不能赋值为'Validator <"horizo​​ntal"| "垂直"| 未定义>"

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)

typescript reactjs react-proptypes

10
推荐指数
2
解决办法
702
查看次数

为什么“(seed * 9301 + 49297) % 233280 / 233280.0”会生成一个随机数?

// 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

random

5
推荐指数
1
解决办法
1127
查看次数

标签 统计

gulp ×2

build ×1

firefox ×1

git ×1

html ×1

html5 ×1

javascript ×1

npm ×1

random ×1

react-proptypes ×1

reactjs ×1

typescript ×1