Tag: gulp

RegEx不会在Gulp.js中执行

我想知道为什么这个正则expression式不会在Gulp任务中执行。 “replace”任务使用gulp-replace。 正则expression式 /url\((?:["'])?(?:\/?[a-zA-Z0-9])*\/([a-zA-Z0-9]{0,}\.(png|jpeg|jpg))(?:["'])?\)/g 实际的一揽子任务 gulp.task('process-sass', function() { return gulp.src('./src/html/**/*.scss') .pipe(sass.sync()) .pipe(replace(/url\((?:["'])?(?:\/?[a-zA-Z0-9])*\/([a-zA-Z0-9]{0,}\.(png|jpeg|jpg))(?:["'])?\)/g, 'url(/src/assets/$1)')) .pipe(minify()) .pipe(rename(function(path) { path.dirname += '/'; path.basename = 'bundle.min'; path.extname = '.css' })) .pipe(gulp.dest('./builds/development')); }); 所有的帮助非常感谢。 谢谢。

netlify:WebSocket连接失败:连接在收到握手响应之前closures

我在Netlify上的应用程序,我得到一些错误:服务器不工作:9aeacd2 … .js:1 WebSocket连接到'wss:// xxxxxxxxxxxxx /:5000'失败:连接在收到握手响应之前closures。 只有开始站点服务。 本地所有作品完美,我没有得到任何错误。 应用程序build立在Netlify(gulp)上,这是有angular度的应用程序。 帮助我,谢谢! 我的服务器代码: "use strict"; process.title = 'node-chat'; var webSocketsServerPort = (process.env.PORT || 5000); var webSocketServer = require('websocket').server; var http = require('http'); var pref = '../'; var fs = require('fs'); var index = fs.readFileSync('src/index.html'); var clients = []; var loggedUsers = []; var tables = []; var […]

如何解决以下浏览错误?

我是新来的使用gulp和browserify。 我正在尝试使用browserify和gulp在线教程。 以下是我的package.json { "name": "progressive", "version": "1.0.0", "description": "Practcing a Progressive Web App", "scripts": { "start": "node ./index.js" }, "author": "Indu Pillai", "devDependencies": { "browserify": "^13.1.0", "gulp": "^3.8.8", "gulp-browserify": "^0.5.1", "gulp-clean-css": "^2.0.13", "gulp-concat-css": "^2.3.0", "gulp-if": "^2.0.1", "gulp-sourcemaps": "^2.2.0", "gulp-uglify": "^2.0.0", "gulp-util": "^2.2.20", "gulp-webserver": "^0.8.8", "jquery": "^3.1.1", "sw-precache": "^4.2.1" }, "dependencies": { "handlebars": "^4.0.5" } […]

gulp-open在createWriteStream之后不工作

我正在使用gulp,gulp-eslint和gulp-open来创build一个ESLint结果的报告。 linting和文件写入部分工作正常,但打开文件的任务,我写了我的报告,没有。 gulp.task('LintAll_Report_After', ['LintAll'], function () { gulp.src('./_reports/eslint-html-result.html').pipe(open()); }); gulp.task('LintAll_Report', function () { gulp.src('./_reports/eslint-html-result.html').pipe(open()); }); gulp.task('LintAll', function () { gulp.src('./_reports/eslint-html-result.html').pipe(open()); var stream = gulp.src(filesToLintGlob) .pipe(eslint()) .pipe(eslint.format('html', fs.createWriteStream('./_reports/eslint-html-result.html'))); //stream.on('finish', function () { // console.log('finished'); // stream.end(); // setTimeout(function () { // gulp.src('./_reports/eslint-html-result.html').pipe(open()); // }, 10000); //}); return stream; }); LintAll删除我的文件,然后将结果写入一个HTML文件。 LintAll_Report在浏览器中打开我的报告。 LintAll_Report_After在完成LintAll任务后应该打开我的报告。 LintAll工作正常。问题是报告打开:LintAll_Report工作,如果自己调用…但LintAll_Report_After不起作用。 没有错误,在任务运行资源pipe理器控制台我什至看到行[13:40:17] Opening C:\GITDEV\stiletto-online\_reports\eslint-html-result.html […]

使用gulp时,Css样式表有错误的path

我一直在挣扎一段时间,坦白地说,这是相当令人沮丧的。 问题: 我为我的静态网站创build了一个gulp文件,我所要做的就是使用browserSync,将sass编译为css,并将脚本和css文件缩小。 一切工作正常,排除一件事情: 当我运行“gulp”时,除了位于“CSS /”中的de css文件外,所有的东西都会被加载。 显然服务器认为css文件实际上是(“CSS / style.css /”)文件夹。 控制台错误的屏幕截图: 图像 该css文件位于“css / style.css” "use strict"; let paths = { script: "js/*.js", minifiedScript: 'script.min.js', cssPath: "css/*.css", productionFolder: "production", sassPath: "scss/*.scss", htmlFiles: "*.html" }; const gulp = require('gulp'); const concat = require('gulp-concat'); const uglify = require('gulp-uglify'); const sourcemaps = require('gulp-sourcemaps'); const del = require('del'); […]

如何从一个带有多个源文件的gulp任务一次返回所有的stream?

我写的一口气的任务打破了我的主要任务中的runSequence。 它必须在其他任务之间运行,如下所示: runSequence( … ':build:prod:staticIndex', ':build:prod:typeDocToMD', // << this is my task ':build:prod:staticDocumentation', …etc 而它之后的任务从未被执行。 这使我认为我的任务不会返回一个单一的stream或不正确。 这是我的任务看起来如何: gulp.task(':build:prod:typeDocToMD', (done: any) => { let taskNum: number = 0; let streams = []; let filesPath = [ path.join(__CONFIG.TMPL_DOCS_PATH, '**/*.md') ]; glob(filesPath.toString(), function (er, files) { taskNum = files.length – 1; files.forEach((filename) => { let stream = gulp.src(filename) […]

Git Bash – Gulp:不能执行命令“gulp”; 错误:找不到模块

我正在关注Bootstrap上的Udemy教程。 我在Git Bash中的文件夹C:/bs4projects/bs4starter中,但是当我运行命令“ gulp ”时,它会给我这个错误: Error: Cannot find module 'C:\c\Users\[username]\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js 我注意到它在path上添加了一个名为“ c ”的额外文件夹,我不知道如何改变它应该查找的PATH 。 我也注意到它不是在我的bs4starter文件夹里面bs4starter 请帮忙,一直在努力寻找解决scheme。 我检查了我的gulp.js安装在我的bs4starter文件夹和\npm\node_modules\gulp-cli文件夹中,他们都在那里,所以我想我正确地安装了它。

Visual Studio 2017,Task Runner Explorer不加载模块

我正在尝试从Task Runner Explorer中构build我的项目。 项目运行良好从cmd,使用au运行。 产生的错误如下: Failed to run "D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\Gulpfile.ts"… cmd.exe /c gulp –tasks-simple D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\gulpfile.js:1 (function (exports, require, module, __filename, __dirname) { define(["require", "exports", "gulp", "gulp-shell"], function (require, exports, gulp, gulp_shell_1) { ^ ReferenceError: define is not defined at Object.<anonymous> (D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\gulpfile.js:1:63) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) […]

自定义捆绑节点安装在其他PC上不起作用

13-10-2017 – 自我回答 ,见下文,问题解决 13-10-2017 – 更新已添加 ,请参阅问题的结尾,仍未解决 先说明,后面的问题: 我们的团队使用一个准备好的开发环境,并且我想用liferay主题生成器添加构buildLiferay dxp主题所需的节点组件。 我已经安装了Win64-Zip-Installation的节点,所以我把它解压缩到一个自定义目录(win10)。 我已经设置了环境variables并创build了.npmrc,前缀(npm-packages)和caching(npm-cache)也驻留在上面提到的自定义目录中。 我已经通过npm(gulp,yo,generator-liferay-theme,liferay-theme-tasks,liferay-theme-deps-7.0,全部用-g)安装了额外的必需组件。 所以我的全球安装看起来像这样 custom directory | +— node-v6.11.4-win-x64 | +— npm-cache | +— npm-packages 环境variables被设置 NODE_PATH=(custom directory)\node-v6.11.4-win-x64;(custom directory)\npm-packages\node_modules NPM_PACKAGES=(custom directory)\npm-packages 包括path Path=…;(custom directory)\node-v6.11.4-win-x64;(custom directory)\npm-packages 而.npmrc就是这样 prefix=(custom directory)\npm-packages cache=(custom directory)\npm-cache proxy=(our proxy) registry=http://registry.npmjs.org/ fetch-retry-mintimeout=1000 fetch-retry-maxtimeout=3000 strict-ssl=false 在我的机器上构buildLiferay DXP主题 – WOMM 当我压缩完整的自定义文件夹并将其解压到另一个开发人员计算机(并在另一台计算机上设置环境variables和.npmrc)时,生成将不起作用。 错误消息(maven antrun exec […]

PATH空间npm

所以我一直在尝试安装gulp ,我不断得到: module.js:471 ^ throw err:can not find module'C:\ c \ Users \ Joe's Steezy Laptop \ AppData \ Roaming \ npm \ node_modules \ gulp-cli \ bin \ gulp.js' 正如你可以看到我的username有空格,我读了npm不能读取有空格的path。 我的问题是我如何解决这个问题? 我知道这是做symbolic links的选项,有一个选项可以让一个全新的用户,并确保用户名文件夹这次没有任何空格。 有另外一种方法可以做到这一点吗? 我不相信自己足够做一个symbolic link因为我读过它,如果你搞砸了,它可能会弄乱你的系统。 我也不是真的想在我的笔记本电脑上创build一个全新的用户,因为那么我必须重新安装我的所有程序。 请任何人都可以帮忙,这将不胜感激!