gulp

Build Mocha test dynamically after getting data from webdriver.io

▼魔方 西西 提交于 2019-12-04 03:36:40
问题 I'm looking for a solution to define Mocha tests after getting data asynchronously. For now, I use gulp-webdriver to getting HTML content with Selenium. And I want tests certain HTML tags structure. For example, I want to get all buttons structure from an HTML page. 1° In Mocha Before(), I get buttons : var buttons = browser.url("url").getHTML("button"); 2° And after that, I want tests each button in a separate it : buttons.forEach(function(button) { it() }); The only solution found is

Import .css file in Less using nodejs gulp

别说谁变了你拦得住时间么 提交于 2019-12-04 03:26:19
According to this question it's possible to import css file from less v.1.4.0. I tried to use gulp-less task, and it's not working. There's any way to import css file like this: @import "../spritesheet.css"; with nodeJS gulp? There are several ways to include files in LESS, depending on what you need, using @import ([keyword]) "filename" . Allowed keywords are: reference: use a Less file but do not output it inline: include the source file in the output but do not process it less: treat the file as a Less file, no matter what the file extension css: treat the file as a CSS file, no matter what

Browserify fails to create bundle with babelify transform (TypeError: Path must be a string.)

杀马特。学长 韩版系。学妹 提交于 2019-12-04 03:25:39
I've written a gulp task to compile my .jsx and .js scripts into a bundle using watchify and babelify as a transform. For some reason my gulp script seems to be choking on the transform and I'm not sure why: gulp.task('browserify', function() { var bundle = watchify(browserify('./app/jsx/client/index.jsx', { extensions: ['.js', '.jsx'], debug: process.env.NODE_ENV === 'development' })); bundle.transform(babelify); bundle.on('update', function() { rebundle(bundle); }); function rebundle(bundle) { return bundle.bundle() .on('error', function(error) { console.log(error.stack, error.message); this

Browserify - ParseError: 'import' and 'export' may appear only with 'sourceType: module

▼魔方 西西 提交于 2019-12-04 03:13:44
问题 In my gulpfile I have var gulp = require('gulp'); var browserSync = require('browser-sync').create(); var sass = require('gulp-sass'); var babel = require("gulp-babel"); var rename = require('gulp-rename'); var source = require('vinyl-source-stream'); var browserify = require('gulp-browserify'); var notify = require("gulp-notify"); gulp.task('js', function () { gulp.src('js/main.js') .pipe(babel()) .pipe(browserify()) .on('error', errorAlert) .pipe(rename('./dist/js/bundle.js')) //.pipe

How to deploy gulp on production server

牧云@^-^@ 提交于 2019-12-04 02:58:17
When building a website (for the sake of clarity an HTML/JS only website) I use gulp to compile and concat some files which are then placed in a build/ folder. The folder structure looks something like this: ├── assets │ ├── images │ ├── javascripts │ │ └── app.js │ └── stylesheets │ └── style.scss ├── bower.json ├── build │ ├── bower_components │ ├── images │ ├── index.html │ ├── scripts.min.js │ └── styles.min.css ├── gulpfile.js ├── index.html ├── node_modules │ ├── gulp-module-1 │ └── gulp-module-2 ├── package.json └── README If I include all these files in a git repo, all of my changes

Gulp less and then minify task

元气小坏坏 提交于 2019-12-04 02:05:24
I have to make 2 steps in gulp: Make a .css file form less Minify generated css files This is my gulpfile: var gulp = require('gulp'), watch = require("gulp-watch"), less = require('gulp-less'), cssmin = require('gulp-cssmin'), rename = require('gulp-rename'); gulp.task('watch-less', function () { watch({glob: './*.less'}, function (files) { // watch any changes on coffee files gulp.start('compile-less'); // run the compile task }); watch({ glob: ['./*.css', '!./*.min.css'] }, function(files) { gulp.start('minify-css'); // run the compile task }); }); gulp.task('compile-less', function () {

非 root 用户全局安装和配置 NodeJS

自闭症网瘾萝莉.ら 提交于 2019-12-04 01:53:21
主要针对 Linux 非 root 用户,在没有 root 权限下如果安装及配置 NodeJS(注:这里安装的是官网上已经编译好的二进制包)。 首先,到 NodeJS 的官网( https://nodejs.org/en/download/ )下载对应的已经编译好的二进制包。 这里以 CentOS7 32bit 为例,安装 NodeJS 的 LTS 版本: 1. 下载 Linux Binaries 64bit 版本: curl -o node-v8.9.4-linux-x64.tar.xz https://nodejs.org/dist/v4.4.2/node-v4.4.2-linux-x86.tar.xz 2. 下载好的二进制压缩包解压至指定的安装目录(这里以~/tools/nodejs 为例) mkdir -p ~/tools/nodejs tar -xJf node-v8.9.4-linux-x64.tar.xz --no-wildcards-match-slash \ --anchored --exclude */CHANGELOG.md --exclude */LICENSE --exclude */README.md \ --strip 1 -C ~/tools/nodejs 注:如果出错并提示 xz: Cannot exec: No such file or

gulp watch terminates immediately

假装没事ソ 提交于 2019-12-04 01:12:51
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, but no dice. $ gulp watch [gulp] Using gulpfile gulpfile.js [gulp] Starting 'watch'... [gulp] Finished

Cache busting images which are linked inside SASS files

情到浓时终转凉″ 提交于 2019-12-04 00:27:54
I'm fairly new to Laravel 5.0, but not to PHP. I've been playing around with Elixir to compile my SASS, copy images from my resource directory and run them through the mix.version function to prevent caching. This works great for CSS, images and JavaScript, however; is it possible to have Elixir cache-bust the images linked in my CSS/SASS as well? Sure it's easily enough to version the images but is there a way of adjusting the CSS to reflect the new filenames? I discovered this: https://github.com/trentearl/gulp-css-url-adjuster which allows you to append a query parameter to the file paths

Gulp babel es2015 transform very slow

♀尐吖头ヾ 提交于 2019-12-03 23:17:31
I am trying to run the babel-preset-es2015 on my JavaScript using gulp, but it takes forever even on one line of code. I originally tried with my script bundle that is about 700 loc, and then with a dummy script that is 1 line. The first case takes about 9s - with 1 line i takes 8.38s. This is my exact setup: package.json: { "devDependencies": { "gulp": "^3.9.0", "gulp-babel": "^6.1.1", "babel": "^6.3.26", "babel-preset-es2015": "^6.3.13" }, "babel": { "presets": [ "es2015" ] } } gulpfile.js: gulp.task('js', function () { return gulp.src('dummyscript.js') .pipe(concat('site.bundle.js')) .pipe