gulp

gulp watch terminates immediately

邮差的信 提交于 2019-12-05 14:11:45
问题 I have a very minimal gulpfile as follows, with a watch task registered: var gulp = require("gulp"); var jshint = require("gulp-jshint"); gulp.task("lint", function() { gulp.src("app/assets/**/*.js") .pipe(jshint()) .pipe(jshint.reporter("default")); }); gulp.task('watch', function() { gulp.watch("app/assets/**/*.js", ["lint"]); }); I cannot get the watch task to run continuously. As soon as I run gulp watch, it terminates immediately. I've cleared my npm cache, reinstalled dependencies etc,

Node.js基本内容和知识点

…衆ロ難τιáo~ 提交于 2019-12-05 14:02:06
### Node.Js入门教程 --- > 简单的说 Node.js 就是运行在服务端的 JavaScript,起初段定位是后端开发语言,由于技术的不够成熟,一般小型项目会完全使用node.js作为后台支撑,大项目中,运行不够稳定,不会轻易使用。具有高并发优良特性,Node.js是一个事件驱动I/O服务端JavaScript环境,基于Google的V8引擎,V8引擎执行Javascript的速度非常快,性能非常好。 > node.js 现在今可以替换很多小型的php项目 ,但是虽然定位为后端语言,但常用于前后端但中间件,例如用于搭建前端服务器,用于替换代理请求等,前端工程化的工具环境等使用。 我们作为前端,需要掌握什么东西? 掌握node.js基本使用,前期不是为了开发后端,主要能够掌握其常规语法,和基础的内置的功能,能够满足一个前端对于前端工具的使用。(不懂语法规范,那么就没有办法去使用前端自动化各种工具) --- 浏览器中的javascript:主要是window窗口中都一些基于事件、DOM操作等功能 后端中NodeJS:不存在window对象与DOM操作,窗口事件 共同特性:都遵循着ECMAScript都标准语法规范 node中没有window对象,它有一个自己的全局对象:global ## # 主要模块: ​ 1.fs 文件操作 ​ 目录的创建与删除 ​ 文件的读取写入 ​

How to use Gulp Browsersync with Django?

爷,独闯天下 提交于 2019-12-05 13:19:23
First time using Gulp and I'm following a couple of tutorials that don't seem to be working quite right for me. I have a real basic project and I just want to learn how to use Gulp for standard things like JavaScript/CSS minification, image reduction, and browser sync. When I run my watch task with Browsersync, it goes to the right URL of localhost:8000 , but it shows Cannot GET / instead of rendering my page. How do I fix this so I can use Browsersync with Django? File directory: gulpfile.js : var gulp = require('gulp'); var sass = require('gulp-sass'); var browserSync = require('browser-sync

Gulp Typescript + Browserify; Bundled sourcemap points to transpiled JS rather than source TS

依然范特西╮ 提交于 2019-12-05 13:12:59
I'm working on a Typescript project that is transpiled to ES5 JS and then run through browserify to create a single .js bundle and sourcemap. The bundled sourcemaps point to the transpiled JS rather than the source TS even though I am generating sourcemaps which properly point to the source TS when transpiling to JS. It's as if browserify is ignoring the existing sourcemaps pointing to the TS code and creating its own new maps to the transpiled JS code. Here are my gulp tasks for reference- code is compiled to a temp folder and then browserified from there. This uses browserify-incremental to

使用gulp实时编译sass/sass

二次信任 提交于 2019-12-05 13:05:23
背景 在我们新开始的项目中,我们打算使用scss来作为我们的样式书写语言。同时,所有的sass/scss文件经过编译转化成css文件后要存放到跟scss/sass文件相同的目录下。整个前端团队已经有实时的代码编译构建工具,那么我们只需要书写自己的实时scss/sass构建工具,生成对应的css文件后,团队的实时构建工具也会触发编译,做打包构建处理。 第三方包选型 基于gulp的sass/scss编译工具有:基于node-sass的 gulp-sass 以及基于Ruby的 gulp-ruby-sass 。但是为了免得再安装Ruby以及一些特定的原因( gulp-ruby-sass与gulp-sass ),我选择了使用gulp-sass。 运行方式及运行效果 你需要全局安装gulp:npm install -g gulp,你需要在你项目的根目录下新建gulpfile.js文件。运行方式就是直接在命令行项目根目录下执行:gulp即可。编译成功后会给出编译成功的提示(当然也可以配置关闭该提示),编译失败则会给出编译失败的提示,并且会在命令行控制台打印出详细的错误信息,同时,错误提示的时候会带有音效。在编译之后的css代码,我们使用了cssbeautify对其进行了格式化,同时,你还可以针对自己的需求对其进行语法检查等。 代码 最终的代码在下面。需要注意的是,

Why “gulp-jest” is failing with: “Please run node with the --harmony flag!”?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 12:39:48
I get the following error when running gulp test : Error: Please run node with the --harmony flag! Here is my gulp task: var jest = require('gulp-jest'); gulp.task('test', function() { return gulp.src('src/**/__tests__').pipe(jest({ rootDir: 'src', scriptPreprocessor: '../node_modules/6to5-jest', unmockedModulePathPatterns: [ 'react' ] })); }); To reproduce: https://github.com/SEEK-Jobs/react-playground Note that npm test works properly (test is failing as expected), but gulp test fails with the error above. Both npm test and gulp test have the same config object: { rootDir: 'src',

Empty object require angular browserify

无人久伴 提交于 2019-12-05 12:24:16
I m facing a problem when I try to use bowserify, angularjs and coffeescript. In fact, when I try to require('angular'), I get an empty object : angular = require('angular') console.log angular ## return an empty object {} configuration = require('../../config/config') console.log configuration ## returns my fully config file correctly I dont know why it doesn't work properly in this case :-/. This is my package.json where I put the my personnal angular dependencies : { "dependencies": { "gulp": "*", "gulp-browserify": "*", "coffeeify": "*", "gulp-concat": "*" }, "browser": { "angular": "./app

Installing CKEditor with npm

旧巷老猫 提交于 2019-12-05 11:56:11
I am trying to install CKEditor in my project. I am using Laravel. I know I could download the files but I like making my life difficult and I decided that I want to install CKEditor as a npm dependency. As stated in their documentation here , I added the package to package.json, like this: "dependencies": { "jquery": "^1.11.1", "bootstrap-sass": "^3.0.0", "elixir-coffeeify": "^1.0.3", "laravel-elixir": "^4.0.0", "font-awesome": "^4.5.0", "ckeditor": "^4.5.7" } Now I guess I have to require it in my app.coffee, and so I tried: window.$ = window.jQuery = require('jquery') require('bootstrap

How do i go to parent directory when using __dirname?

喜欢而已 提交于 2019-12-05 10:51:11
Directory structure : WebApiRole GulpFile.js test Karma.conf.js Gulp code from GulpFile.js gulp.task('test', function (done) { karma.start({ configFile: _configFile: __dirname + '\\..\\test\\karma.conf.js', singleRun: true }, done); }); So my problem going to the parent directory and access the karma.conf.js . For some reason the path is not get resolved with ..\\ to go back to the parent directory of WebApiRole . can someone point me in the right direction ? I had to use path package to resolve this issue . var path = require("path"), fs = require("fs"); gulp.task('test', function (done) {

一个后端的前端学习之旅——2.先搞定gulp

我是研究僧i 提交于 2019-12-05 10:27:41
这是我的小本本的笔记,先列出了dev中用到的东西,blog可能写了就懒得懂了,但是小本本是随时更新的 小本本位置 一个gulp的脚手架 https://github.com/WINTR/gulp-frontend-scaffold npm淘宝镜像 http://npm.taobao.org/ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \ --cache=$HOME/.npm/.cache/cnpm \ --disturl=https://npm.taobao.org/dist \ --userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc install cnpm install -g gulp bower git clone https://github.com/WINTR/gulp-frontend-scaffold.git && cd gulp-frontend-scaffold cnpm install # 然而这个项目并不好用,里面有的东西无法安装了,我fork了一份重新装了一下 # https://github.com/duoduo369/gulp-frontend-scaffold,