diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2481347 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/node_modules + +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..b4c3129 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# lineman-bower + +This is a plugin to make it easy to use Bower in conjunction with a +[Lineman](http://linemanjs.com) app. + +## Usage + +First, add the plugin to your lineman project: + +``` +$ npm install lineman-bower --save-dev +``` + +Second, you'll want to make sure that your bower dependencies don't get checked +into git, so add them to your `.gitignore`: + +``` +/vendor/bower +``` + +Next, you'll need a `bower.json` to start pulling down dependencies: + +``` +{ + "name": "my-app", + "version": "0.0.1", + "dependencies": { + "jquery": "~1.9.0" + } +} +``` + +Finally, you'll want to make sure that jquery is made available when Lineman +concatenates your vendor JavaScript libraries. You can do this by extending the +`js.vendor` configuration in `config/files.js` like so: + +``` +module.exports = require(process.env["LINEMAN_MAIN"]).config.extend("files", { + js: { + vendor: [ + "vendor/bower/jquery/jquery.js", + "vendor/js/**/*.js" //Note that this glob remains for traditional vendor libs + ] + } +}); +``` + +Now, when you run `lineman run` and visit [localhost:8000](http://localhost:8000), +you should see Bower install jQuery and have access to the library on the page. diff --git a/config/plugins/bower.coffee b/config/plugins/bower.coffee new file mode 100644 index 0000000..6f57341 --- /dev/null +++ b/config/plugins/bower.coffee @@ -0,0 +1,16 @@ +module.exports = (lineman) -> + config: + loadNpmTasks: lineman.config.application.loadNpmTasks.concat("grunt-bower-task") + + prependTasks: + common: ["bower"].concat(lineman.config.application.prependTasks.common) + + clean: + bower: + src: "vendor/bower" + + bower: + install: + options: + targetDir: "vendor/bower" + cleanBowerDir: true diff --git a/main.js b/main.js new file mode 100644 index 0000000..99cb562 --- /dev/null +++ b/main.js @@ -0,0 +1,3 @@ +module.exports = { + version: require('./package').version +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..dcf2474 --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "lineman-bower", + "title": "A Bower plugin for Lineman", + "version": "0.0.1", + "homepage": "https://github.com/testdouble/lineman-bower", + "author": { + "name": "Justin Searls", + "company": "Test Double" + }, + "repository": { + "type": "git", + "url": "git://github.com/testdouble/lineman-bower.git" + }, + "main": "main.js", + "dependencies": { + "grunt-bower-task": "~0.3.4", + "coffee-script": "~1.6.3", + "grunt": "~0.4.2" + }, + "devDependencies": { + "grunt": "~0.4.1" + }, + "peerDependencies": { + "lineman": ">= 0.19.0" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://mit-license.org" + } + ] +}