gulp

es6 Map() doesn't compile to es5 when using Typescript

跟風遠走 提交于 2019-12-01 20:36:36
I've just started using Typescript in a project for the first time. I really want to use Map() to organize a small array of key value pairs. Unfortunately when the typescript is compiled (using gulp and gulp-typescript) to vanilla, ES5 JavaScript, Map() still exists. I need this code to work in ie9. Any advice at this stage would be greatly appreciated. Map is a part of ES6 and have nothing to do with TypeScript. If you want tot use Map in ES5 environment you should include an appropriate polyfill. My first two thoughts are: es6-map module core-js/es6/map from core-js generic ES6 polyfill

Copy angular-ui-grid fonts into .tmp/fonts

雨燕双飞 提交于 2019-12-01 20:12:30
I was experiencing a known issue with Angular UI Grid where some of my fonts would look Korean in production. I applied a certain fix by adding the following CSS: @font-face { font-family: 'ui-grid'; src: url('../fonts/ui-grid.eot'); src: url('../fonts/ui-grid.eot#iefix') format('embedded-opentype'), url('../fonts/ui-grid.woff') format('woff'), url('../fonts/ui-grid.ttf?') format('truetype'), url('../fonts/ui-grid.svg?#ui-grid') format('svg'); font-weight: normal; font-style: normal; } This fixed the problem in production, but now in development I get these errors in the browser console: GET

Including current year in Header file with Gulp Header

北城以北 提交于 2019-12-01 19:17:40
Is there anyway to print out the current year in a header file using Gulp Header ? Here's an example of what I'd like to do: var banner = ['/**', ' * Copyright (c) 2014 Cofey', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @link <%= pkg.homepage %>', ' * @license <%= pkg.license %>', ' */', ''].join('\n'); Looks like gulp uses lodash templates; you should be able to include arbitrary JavaScript: var banner = ['/**', ' * Copyright (c) <%= new Date().getFullYear() %> Cofey', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>',

Gulp Sass not compiling partials

自古美人都是妖i 提交于 2019-12-01 17:59:56
So I am using Gulp Sass with gulp-changed (i've also tried gulp-newer with the updated syntax changes) and watching all the scss files in my folders. When I change a base scss file it will compile without any problems. However if I change a partial it won't compile the sass file that has a dependency on that partial. Gulp var SRC = './stylesheets/**/*.scss'; var DEST = './stylesheets'; gulp.task('sass', function() { return gulp.src(SRC) .pipe(changed(DEST, { extension: '.css' })) .pipe(plumber({ errorHandler: handleErrors })) .pipe(sourcemaps.init()) .pipe(sass({ includePaths: [ 'C:/var/www

copying files with gulp

丶灬走出姿态 提交于 2019-12-01 17:46:42
问题 I have an app. My app source code is structured like this: ./ gulpfile.js src img bg.png logo.png data list.json favicon.ico web.config index.html deploy I am trying to use Gulp to copy two files: ./img/bg.png and ./data/list.json. I want to copy these two files to the root of the deploy directory. In other words, the result of the task should have: ./ deploy imgs bg.png data list.json How do I write a Gulp task to do this type of copying? The thing that is confusing me is the fact that I

Gulp run fails on windows | Error Message : Microsoft JScript compilation error, Invalid character

扶醉桌前 提交于 2019-12-01 17:42:06
I installed Node.js on my windows 7 local machine as this link says : install-node-js-npm-windows After that i installed Gulp.js by this command through command line : npm install -g gulp And then i add this path to environment variables area : C:\Users\Majid\AppData\Roaming\npm\node_modules\gulp\bin Now when i try to run gulp by this command : gulp I got this error : Windows Script Host Line: 1 Char: 1 Error: Invalid character Code: 800A03F6 Source: Microsoft JScript compilation error How can i solve this error & how can i make gulp.js workable on windows OS? EDIT AFTER THE ANSWER : Error is

Gulp watch all files but render only one (sass)

最后都变了- 提交于 2019-12-01 17:31:07
问题 I want to make gulp watch for all changes on my work folders but to generate only one file. Because I use scss which imports all required files, there is no need to compile all .css files, only main one. Now, my gulpfile.js contains: var gulp = require('gulp'); var util = require('gulp-util'); var sass = require('gulp-sass'); gulp.task('sass', function () { return gulp.src('./sass/style.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./dist/css')); }); gulp.task('watch',

Including current year in Header file with Gulp Header

喜欢而已 提交于 2019-12-01 17:21:38
问题 Is there anyway to print out the current year in a header file using Gulp Header? Here's an example of what I'd like to do: var banner = ['/**', ' * Copyright (c) 2014 Cofey', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @link <%= pkg.homepage %>', ' * @license <%= pkg.license %>', ' */', ''].join('\n'); 回答1: Looks like gulp uses lodash templates; you should be able to include arbitrary JavaScript: var banner = ['/**', ' * Copyright (c) <%= new Date()

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

对着背影说爱祢 提交于 2019-12-01 17:01:54
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(uglify()) .pipe(gulp.dest('./')) .pipe(notify({title: "Success", message: "Well Done!", sound: "Glass"})); }

combine html template files into one JS file

China☆狼群 提交于 2019-12-01 16:43:28
I have HTML template files (underscore template syntax) These files are saved in HTML format so they would be easy to edit (IDE syntax highlight) I don't want to fetch them with ajax, but rather combine them all and include them as a js file. Using GULP as my task-runner, I would like it to somehow combine all the HTML to something like this, as a javascript file that I could include in my BUILD process: template_file_name is the HTML file name. var templates = { template_file_name : '...template HTML string...', template_file_name2 : '...template HTML string...', template_file_name3 : '..