1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# Blade
### A [Sprockets](https://github.com/rails/sprockets) Toolkit for Building and Testing JavaScript Libraries
## Getting Started
Add Blade to your `Gemfile`.
```ruby
source "https://rubygems.org"
gem 'blade'
```
Create a `.blade.yml` (or `blade.yml`) file in your project’s root, and define your Sprockets [load paths](https://github.com/rails/sprockets#the-load-path) and [logical paths](https://github.com/rails/sprockets#logical-paths). Example:
```yaml
# .blade.yml
load_paths:
- src
- test/src
- test/vendor
logical_paths:
- widget.js
- test.js
```
## Compiling
Configure your build paths and [compressors](https://github.com/rails/sprockets#minifying-assets):
```yaml
# .blade.yml
…
build:
logical_paths:
- widget.js
path: dist
js_compressor: uglifier # Optional
```
Run `bundle exec blade build` to compile `dist/widget.js`.
## Testing Locally
By default, Blade sets up a test runner using [QUnit](http://qunitjs.com/) via the [blade-qunit_adapter](https://github.com/javan/blade-qunit_adapter) gem.
Run `bundle exec blade runner` to launch Blade’s test console and open the URL it displays in one or more browsers. Blade detects changes to your logical paths and automatically restarts the test suite.

## Testing on CI
Run `bundle exec blade ci` to start Blade’s test console in non-interactive CI mode, and launch a browser pointed at Blade’s testing URL (usually http://localhost:9876). The process will return `0` on success and non-zero on failure.
To test on multiple browsers with [Sauce Labs](https://saucelabs.com/), see the [Sauce Labs plugin](https://github.com/javan/blade-sauce_labs_plugin).
## Projects Using Blade
* [Trix](https://github.com/basecamp/trix)
* [Turbolinks](https://github.com/turbolinks/turbolinks)
* [Action Cable](https://github.com/rails/rails/tree/master/actioncable)
---
Licensed under the [MIT License](LICENSE.txt)
© 2016 Javan Makhmali
|