Tag: 手表

webpack手表不会触发

我使用本地文件系统(inotify)支持来运行webpack,并且使用chokidar进行了testing,并正确地获取了该文件系统/文件夹中所有文件的更改。 使用Sage 9 WordPress基本主题中的webpackconfiguration( https://github.com/roots/sage/blob/c21df9965ff8217c3b4ff90bbe6099206d7b4fbf/resources/assets/config.json#L16 )。 只有PHP文件被列出才能被监视 – 但是它们的依赖关系(SCSS / JS / …)也被监视了? 我开始使用npm / yarn包脚本启动webpack手表,使用$ webpack –hide-modules –watch –config resources/assets/build/webpack.config.js启动$ webpack –hide-modules –watch –config resources/assets/build/webpack.config.js Webpack is watching the files… [BS] [HTML Injector] Running… [BS] Proxying: http://dev:8084 [BS] Access URLs: ———————————- Local: http://localhost:3000 External: http://127.0.0.1:3000 ———————————- UI: http://localhost:3001 UI External: http://127.0.0.1:3001 ———————————- [BS] Watching […]

nodejs:primefaces文件replace操作,只触发一次观察者一次

我有两种过程。 一个人应该写一个文件,其他人应该读它,如果它被改变。 我发现fs.watch得到读取过程通知,如果他们必须重新加载文件。 要写文件,我可以使用fs.writeFile 。 但是我不确定,如果这是一个primefacesreplace。 如果文件很大,会多次触发watch ? 将这个作为primefaces操作,正确的方法是什么? 仅供参考:在目标系统上运行Linux。

NodeJs:具有依赖关系的外部JavaScript

我们试图只使用nodeJS,而对其他软件包的依赖性最小,我们现在遇到的挑战是HandelbarsJS。 我们find了一个包,可以为我们生成html的Assemble。 只有,这个3秒内每次大约3秒很慢,下一行有2.5 / 2,7秒: var assemble = require('assemble'); 我们的package.json脚本部分: "scripts": { "build:handlebars": "node scripts/handlebars.js", "watch:handlebars": "nodemon –watch assets –exec \"npm run build:handlebars\"" } 脚本/ handlebars.js文件 #! /usr/bin/env node var assemble = require('assemble'); var extname = require('gulp-extname'); console.log(Date.now() – start); assemble.data('assets/templates/data/*.json'); assemble.layouts('assets/templates/layouts/*.hbs'); assemble.partials('assets/templates/partials/*.hbs'); assemble.src('assets/templates/*.hbs', { layout: 'default' }) .pipe(extname()) .pipe(assemble.dest('build/')); 每当我们保存一个.hbs文件,Nodemon重启和外部的javascript文件都会被调用。 我们如何确保“要求”只被调用一次,还是保持在记忆中? 谢谢!

使用gulp.watch抛出“TypeError:Object#<Object>没有方法'看'”

所以我添加了一个watch任务给我的gulpfile.js,看起来像这样: gulp.task('watch', function(){ gulp.watch('src/style/*.less', ['css']); }); 但是当我运行它( gulp watch )时,我得到了以下错误在我的脸上: PS C:\Projects\web\basic> gulp watch [21:28:42] Using gulpfile C:\Projects\web\basic\gulpfile.js [21:28:42] Starting 'watch'… [21:28:42] 'watch' errored after 226 μs [21:28:42] TypeError: Object #<Object> has no method 'watch' at Gulp.watch (C:\Projects\web\basic\node_modules\gulp\index.js:40:14) at Gulp.<anonymous> (C:\Projects\web\basic\gulpfile.js:37:7) at module.exports (C:\Projects\web\basic\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7) at Gulp.Orchestrator._runTask (C:\Projects\web\basic\node_modules\gulp\node_modules\orchestrator\index.js:273:3) at Gulp.Orchestrator._runStep (C:\Projects\web\basic\node_modules\gulp\node_modules\orchestrator\index.js:214:10) at Gulp.Orchestrator.start (C:\Projects\web\basic\node_modules\gulp\node_modules\orchestrator\index.js:134:8) at C:\Users\Magnus\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20 […]

咕噜咕噜地看着咖啡和玉石文件

我想同时观看我的咖啡和咕噜声文件。 当我只是看咖啡文件没有问题,但是当我添加一个玉观察员到我的文件观察员只编译一次 ,虽然有一个更新,观察员没有编译这些新的更新。 任何帮助表示感谢: 这里是我的系统中只有咖啡监视器的时候: 每当咖啡文件有更新时编译: Gruntfile.coffee module.exports = (grunt) -> grunt.initConfig pkg : grunt.file.readJSON "package.json" coffee : compile : options : sourceMap: on files : ['dist/client/js/main.js': 'client/app/scripts/app.coffee', 'server.js': 'server.coffee'] watch : coffee : options : atBegin: yes files : [ 'client/scripts/*.coffee', 'client/scripts/controllers/*.coffee', 'server.coffee'] tasks : ['coffee', 'jade'] grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.registerTask 'default', ['watch'] […]

Gulp.js:“gulp-chug”只能运行一个文件,即使设置为观看很多

我已经开始与Gulp合作了,而我遇到的问题就是使得Gulp -chug正常工作。 我已经按照文档中的所有内容,告诉我的大文件观察某些目录中的所有gulp文件,而它只监视一个文件。 这是我使用的文档后面的代码… var gulp = require('gulp'); var chug = require('gulp-chug'); gulp.task('default', function () { gulp.src('**/task_runner/gulpfile.js') .pipe(chug()); }); 我甚至试图看看,如果我把文件path放在数组中,是否有所作为… … gulp.src( [ '**/task_runner/gulpfile.js' ] ) … 我也试过这个(和没有在gulp.src()中的数组的版本)… … gulp.src( [ 'Project_01/task_runner/gulpfile.js', 'Project_02/task_runner/gulpfile.js' ] ) … …它仍然是一样的事情。 我的文件结构看起来像这样, *root* node_modules gulpfile.js package.json Project_01 css scss task_runner Project_02 css scss task_runner 所有的gulpfiles在单独运行时都能正常工作,但是我希望它们都能够在一个cmd窗口中同时运行,并且有一定的吞吐量。 这是我的CMD看起来像,这是显示,它只是看着Project_02, C:\Users\WaheedJ\Desktop\UniServer\www\Practice\gulp>gulp [14:19:40] Using […]

Gulp Watching创build无限循环而不更改文件

类似于其他问题,在这个非常淡化的代码片断中,运行默认的 gulp任务(通过npm start运行gulp ); 这段代码创build了一个循环运行脚本任务的无限循环。 这里是gulpfile.js (字面上目前是整个事情): 'use strict'; const gulp = require('gulp'); // COPY SCRIPTS TO BUILD FOLDER gulp.task('scripts', function() { return gulp.src('./scripts/**/*.js') .pipe(gulp.dest('build/scripts')) }); // WATCH FILES gulp.task('watch', function() { gulp.watch('./scripts/**/*.js', ['scripts']); }); // DEFAULT gulp.task('default', ['watch']); 更奇怪的是,不pipebuild文件夹是否重build ,脚本任务将在调用npm start后立即执行! 循环开始。 如果你好奇,这里是我的package.json中粘贴的(也是唯一的)脚本对象: "scripts": { "test": "echo \"Error: no test specified\" && exit 1", […]

当我改变观看的文件时,fs.watch发射了两次

fs.watch( 'example.xml', function ( curr, prev ) { // on file change we can read the new xml fs.readFile( 'example.xml','utf8', function ( err, data ) { if ( err ) throw err; console.dir(data); console.log('Done'); }); }); OUTPUT: 一些数据 完成X 1 一些数据 完成X 2 这是我的用法错误还是..?

Grunt中的Nodemon-like任务:执行节点进程和监视

我觉得我失去了一些东西。 这是我想要达到的: 有一个咕噜的任务执行我的server.js和并行运行watch任务。 我觉得这正是Gruntdevise的任务之一,但我无法实现这种configuration。 其中,我读过这个: 通过Grunt运行Node应用程序,但我仍然无法做到。 这是我的Gruntfile.js: module.exports = function(grunt) { // Project configuration. grunt.initConfig({ watch: { scripts: { files: ['*.js'], tasks: ['start'], options: { nospawn: true } } } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('start', function() { grunt.util.spawn({ cmd: 'node', args: ['server.js'] }); grunt.task.run('watch'); }); grunt.registerTask('default', 'start'); }; 我有"grunt-contrib-watch": "~0.3.1" grunt-contrib-watch@0.3.0 "grunt-contrib-watch": "~0.3.1" ,应该比前面提到的文章更高版本,比grunt-contrib-watch@0.3.0 。 如果你能帮我实现适当的configuration,我将非常感激。 但更一般的说,我不明白为什么没有官方的grunt-contrib-nodemon-like软件包和任务,因为我感觉这将是使用grunt(我真的很喜欢这个工具! […]