From fbff27c85c3a6d511f1201e3dc794245fa49f28c Mon Sep 17 00:00:00 2001 From: Lauri Hahne Date: Wed, 24 Sep 2014 12:00:32 +0300 Subject: [PATCH 1/3] add debowerify and deamdify --- gulpfile.coffee | 2 ++ package.json | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gulpfile.coffee b/gulpfile.coffee index 367de23..1e6deaa 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -15,6 +15,8 @@ ecstatic = require 'ecstatic' livereload = require 'gulp-livereload' plumber = require 'gulp-plumber' prefix = require 'gulp-autoprefixer' +debowerify = require 'debowerify' +deamdify = require 'deamdify' production = process.env.NODE_ENV is 'production' diff --git a/package.json b/package.json index c3d530e..91809b9 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "gulp", "template" ], - "author": "", "dependencies": { "coffee-script": "~1.7.1" }, @@ -41,13 +40,17 @@ "gulp": "~3.8.1", "watchify": "~0.10.2", "ecstatic": "~0.5.3", - "gulp-minify-css": "~0.3.5" + "gulp-minify-css": "~0.3.5", + "deamdify": "^0.1.1", + "debowerify": "^0.8.1" }, "browser": {}, "browserify-shim": {}, "browserify": { "transform": [ "coffeeify", + "debowerify", + "deamdify", "browserify-shim" ] } From 085c4e20126c4dcfae64333a95aa5c31fb665cf2 Mon Sep 17 00:00:00 2001 From: Lauri Hahne Date: Wed, 24 Sep 2014 12:09:23 +0300 Subject: [PATCH 2/3] update readme --- README.md | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a33b921..41dbe73 100644 --- a/README.md +++ b/README.md @@ -41,34 +41,33 @@ Minification, uglification and other tasks you're expected to run before deployi bower install jquery --save -Now to use jQuery in your frontend code, you'll need to add jQuery to "browser" section of your package.json. Your package.json should be something like this: - - ... - - "browser": { - "jquery": "./bower_components/jquery/dist/jquery.js" - }, - "browserify-shim": {}, - "browserify": { - "transform": [ "coffeeify", "browserify-shim" ] - } - ... - Now your should be able to require jQuery in your coffee files $ = require 'jquery' -For non-CommonJS compatible modules you have to use browserify-shim. Read more about it [here](https://github.com/thlorenz/browserify-shim). +If this does not work, you may need to add the pakcage manually and shim it, like + + ... + + "browser": { + "tunkki": "./bower_components/tunkki/dist/tunkki.js" + }, + "browserify-shim": { + "tunkki": "tunkki" + } + ... + +Read more about it [here](https://github.com/thlorenz/browserify-shim). ### Using JavaScript instead of CoffeeScript -Remove coffeeify transform from package.json file (browserify.transform field) +Remove coffeeify transform from package.json file (browserify.transform field) `````` "browserify": { "transform": ["browserify-shim"] } `````` -and change the ".coffee" extension to ".js" from gulpfile.coffee +and change the ".coffee" extension to ".js" from gulpfile.coffee `````` paths = scripts: From 55892fff7caac404008a7341cc83f4e0d6e77d10 Mon Sep 17 00:00:00 2001 From: Lauri Hahne Date: Wed, 24 Sep 2014 14:01:31 +0300 Subject: [PATCH 3/3] remove unnecessary requires from gulpfile --- gulpfile.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/gulpfile.coffee b/gulpfile.coffee index 1e6deaa..d88e5ba 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -10,13 +10,10 @@ source = require 'vinyl-source-stream' streamify = require 'gulp-streamify' rename = require 'gulp-rename' uglify = require 'gulp-uglify' -coffeeify = require 'coffeeify' ecstatic = require 'ecstatic' livereload = require 'gulp-livereload' plumber = require 'gulp-plumber' prefix = require 'gulp-autoprefixer' -debowerify = require 'debowerify' -deamdify = require 'deamdify' production = process.env.NODE_ENV is 'production'