Tag: gulp

debugging通过Gulp任务启动的node.js Web应用程序

我有一个写在node.js中的web应用程序,并开始使用gulp命令。 当应用程序第一次启动时,在服务器运行之前,可能会在WebStorm(或者任何IDE或命令行工具)中点击debugging点。 但是,服务器运行后,我去我的本地主机的接口,我不能再打在应用​​程序内部的debugging点。 这不是由客户端代码造成的,因为debugging点在服务器代码中。 我已经阅读了涉及使用节点检查器的答案,并没有解决我的问题,因为configuration文件在节点检查器中启动debugging器时没有被读取。 对于这个问题,我感到有点惊讶。 其他开发者面临的问题不是一个正常的问题吗? 先谢谢您的帮助。

NpmtestingYeoman定制发生器

几天前我已经开始写一个自定义yeoman发生器,我想做一个testing(所以我可以使用travis ECC),但我有一个问题,当我午餐npm test 。 我的生成器只复制4个文件,一个gulpfile.js和3个文件在不同的文件夹,所以最终的结果是: Project-folder | |—– gulpfile.js |——–production ———css/main.css ———html/index.html ———js/index.js 我想testing我的发生器,所以我写这个testing,我开始写它从发电机发电机提供的模板testing app.js 'use strict'; var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); describe('generator-postcss-template:app', function () { before(function () { return helpers.run(path.join(__dirname, '../generators/app')) .withPrompts({someAnswer: true}) .toPromise(); }); it('creates files', function () { assert.file([ 'production/css/styles.css', 'production/html/index.html' ]); }); }); 当我午餐npmtesting我有这个错误 […]

Gulp:如何设置不同的生产基地

我是一个Gulp新手(也许我的问题是愚蠢的)。 在开发过程中,我使用localhost和root文件夹中的gulp serve ,例如: HTTP://本地主机:3000 / 但在生产上,我想移动我的应用程序在一个文件夹,例如: HTTP://本地主机:3000 /我的应用程序内/ 问题是在index.html中, dev “base href”从: <base href="/"> 到prod : <base href="/my-app/"> 我可以改变我的基础href有条件的html评论吗? 例如。: <!– build:dev –> <base href="/"> <!– endbuild –> <!– build:prod –> <base href="/my-app/"> <!– endbuild –> 任何其他技巧是非常感激! 我发现了这个提示: return gulp.src(path.join(conf.paths.tmp, '/serve/*.html')) .pipe(replace('<base href="/">', '<base href="/my-app/">'))

如何使用Browserify和Gulp启动多页面应用程序

好吧,我接近终点线,我用Gulp和Browserify构build了新的PHP / JS应用程序。 最后一部分是如何“开机”,我的意思是如何做“第一个电话”。 假设我有3个JS入口点 /js/articles.js /js/categories.js /js/comments.js 他们每个人都使用一些JS模块。 然后我有3个HTML文件,需要他们的JS /articles.html /categories.html /comments.html 例如/js/articles.js var $ = require("jquery"); var common = require("../common.js"); var viewModel = { readData: function() { /* read record from API and render */ }, insert: function() { /* open a modal to insert new record */ } }; 我现在要做的就是执行这种“引导”:调用一些我需要的init函数,然后加载服务器数据,然后绑定所有的button和东西到viewModel的方法 $(document).ready(function() { […]

TypeError:from.pipe不是吞食泵的function

我正在使用下面的gulpfileconfiguration: gulp.task('watch', (cb) => { pump([ nodemon({ script: './server.js', ext: 'js', ignore: [ './dist', './public' ] }), gulp.watch('public/js/**/*.js', [ 'build-js' ]), gulp.watch('public/less/**/*.less', [ 'build-css' ]), gulp.watch([ 'public/views/**/*.html', 'public/index.html' ], [ 'build-html' ]) ], cb) }) 只要服务器文件发生更改,它就会重新启动服务器,或者在./public文件更改时运行相应的生成任务。 构build任务只是简单的缩小和concat任务,它们自己工作正常,所以这不是问题。 现在每当我运行它,我得到以下stacktrace: [15:52:51] 'watch' errored after 69 ms [15:52:51] TypeError: from.pipe is not a function at pipe (/home/linux/IdeaProjects/project/node_modules/pump/index.js:54:15) at […]

如何在NPM v5上安装Gulp v4?

我已经安装了新版本的npm,但现在当我尝试运行下一个命令时,依赖项不会被安装: npm i -S gulpjs/gulp#4.0 npm ERR! code ETARGET npm ERR! notarget No matching version found for undefined@4.0 npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. NPM版本:v5.0.1 有没有从github分支安装npm包的新方法? 相关的问题(旧的NPM版本): 取决于在package.json中使用git URL的分支或标记? 有关安装依赖性的NPM文档: npm install docs

在Docker容器代码中使用Gulp命令139

我有这个docker-compose文件: rest-api: image: x/rest-api build: context: ./rest-api/dockerfiles/ dockerfile: local.Dockerfile environment: – BUILD_ENV=local ports: – "8001:8001" volumes: – ./rest-api:/var/www/rest-api user: $UID web: image: x/web-front build: context: ./web-front dockerfile: dockerfiles/local.Dockerfile environment: – BUILD_ENV=local depends_on: – rest-api links: – rest-api ports: – "3001:3001" – "35729:35729" volumes: – ./web-front:/var/www/web-front – ./web-front/logs/:/root/.npm/ user: $UID 和这2个local.dockerfile。 REST的API: FROM node:8-alpine RUN mkdir […]

针对节点应用程序的LibSass的SCSS编译器替代品

Libsass似乎是SCSS最受欢迎的编译器之一, http ://sass-lang.com/libsass列出了许多常用编程语言的各种libsass包装器。 对于一个节点应用程序, node-sass和相应的webpack或gulp加载器似乎是最明显的select。 然而,安装和使用node-sass需要github的访问权限和一个python 2.7的解释器,而我不想在这里讨论的原因,我没有在我的生产环境中。 在没有github访问权限和python解释器的情况下,在生产环境中安装和使用node-sass是否有一个可行的解决方法? 是否还有其他SCSS – 编译器可以通过webpack或gulp使用,不需要Github访问和/或安装的Python解释器?

使用VSCode在浏览器中debugging简单的Typescript应用程序

我正在构build我的第一个打字稿项目(我的背景是C#,Java)。这些应用程序按预期工作,但是我不能在打字稿中放置一个断点并debugging应用程序。 此外,当我使用纯打字机编译器(tscs与tsc.exe)映射完美的作品。 我正在使用gulp,因为我想将所有js放入一个文件中。 当生成的js中有一个错误,那么Visual Studio代码打击js文件(bundle.js)中的断点而不是打字稿,但是自定义断点不工作 我正在使用Windows 10进行开发。 请在下面find我的代码。 HTML 的index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Hello World!</title> <!– <script data-main="main" src="scripts/require.js"></script> –> </head> <body> <p id="greeting">Loading …</p> <script src="bundle.js"></script> </body> </html> 键入脚本 main.ts import { Student } from "./student"; class Startup { public static main(): string { return Startup.showHello(); } public static showHello() […]

Gulp / Node.js错误:连接ECONNREFUSED

我目前正在使用WAMP运行本地服务器,并且正在尝试设置Gulp.js. 这里是我的gulpfile的内容: var gulp = require('gulp'), sass = require('gulp-ruby-sass'), autoprefixer = require('gulp-autoprefixer'), minifycss = require('gulp-minify-css'), minifyhtml = require('gulp-minify-html'), jshint = require('gulp-jshint'), uglify = require('gulp-uglify'), imagemin = require('gulp-imagemin'), rename = require('gulp-rename'), clean = require('gulp-clean'), concat = require('gulp-concat'), notify = require('gulp-notify'), cache = require('gulp-cache'), livereload = require('gulp-livereload'), lr = require('tiny-lr'), server = lr(); gulp.task('styles', function() { gulp.src('src/styles/main.scss') […]