Merge pull request #9 from lhahne/master

add debowerify and deamdify
This commit is contained in:
Lauri Hahne
2014-09-24 14:02:39 +03:00
3 changed files with 20 additions and 19 deletions

View File

@@ -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:

View File

@@ -10,7 +10,6 @@ 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'

View File

@@ -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"
]
}