Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
eprev committed Feb 22, 2013
0 parents commit cadeb2c
Show file tree
Hide file tree
Showing 24 changed files with 1,548 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
node_modules
npm-debug.log
test/tmp
test/fixtures/**/*.js
test/fixtures/**/*.xml.js
11 changes: 11 additions & 0 deletions .jshintrc
@@ -0,0 +1,11 @@
{
"expr" : true,
"evil" : true,
"node" : true,
"undef" : true,
"strict" : false,
"browser": true,
"sub" : true,
"unused" : true,
"indent" : 4
}
5 changes: 5 additions & 0 deletions .travis.yml
@@ -0,0 +1,5 @@
language: node_js
node_js:
- 0.8
before_script:
- npm install -g grunt-cli
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,2 @@
v0.1.0
Initial release.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
@@ -0,0 +1 @@
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
96 changes: 96 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,96 @@
/*
* grunt-fest
* https://github.com/eprev/grunt-fest
*
* Copyright (c) 2013 Anton Eprev
* Licensed under the MIT license.
*/

'use strict';

module.exports = function (grunt) {

// Project configuration.
grunt.config.init({
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js',
'<%= nodeunit.tests %>'
],
options: {
jshintrc: '.jshintrc'
}
},

// Before generating any new files, remove any previously-created files.
clean: {
tests: ['test/tmp', 'test/fixtures/**/*.js', 'test/fixtures/**/*.xml.js']
},

// Configuration to be run (and then tested).
fest: {
options: {
compile: {
beautify: true,
debug: true
}
},
put_in_the_same_derictory: {
src: 'test/fixtures/qux/**/*.xml'
},
put_in_the_same_derictory_and_append_ext: {
src: 'test/fixtures/qux/**/*.xml',
options: {
ext: '.xml.js'
}
},
'test/tmp': ['test/fixtures/qux/**/*.xml'],
dynamic_expansion: {
files: [{
expand: true, // Enable dynamic expantion.
src: ['test/fixtures/qux/**/*.xml'],
dest: 'test/tmp/dynamic', // Destination path prefix.
ext: '.js' // Dest filepaths will have this extension.
}]
},
dynamic_expansion_with_cwd: {
files: [{
expand: true, // Enable dynamic expantion.
cwd: 'test/fixtures', // Src matches are relative to this path.
src: ['**/*.xml'], // Actual pattern(s) to match.
dest: 'test/tmp/dynamic-compiled', // Destination path prefix.
ext: '.js' // Dest filepaths will have this extension.
}],
options: {
compile: {
debug: false,
beautify: false
}
}
}
},

// Unit tests.
nodeunit: {
tests: ['test/*_test.js']
}

});

// Actually load this plugin's task(s).
grunt.loadTasks('tasks');

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');

// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('test', ['clean', 'fest', 'nodeunit']);

// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'test']);

};
22 changes: 22 additions & 0 deletions LICENSE.md
@@ -0,0 +1,22 @@
Copyright (c) 2013 Anton Eprev

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
163 changes: 163 additions & 0 deletions README.md
@@ -0,0 +1,163 @@
# grunt-bem [![Build Status](https://travis-ci.org/eprev/grunt-bem.png)](https://travis-ci.org/eprev/grunt-bem)

> Compile [Fest](https://github.com/bem/bem-tools) templates.
## Getting Started

This plugin requires Grunt `~0.4.0`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-bem --save-dev
```

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-bem');
```

## The "bem" task

### Overview

In your project's Gruntfile, add a section named `bem` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
bem: {
options: {
// Task-specific options go here.
},
target: {
// Target-specific options go here.
}
}
})
```

### Options

#### options.require

Type: `String`
Default value: `bem`

Path to require BEM library.

#### options.root

Type: `String`
Default value: `.`

Project root (cwd by default).

#### options.method

Type: `String`
Default value: `make`

Method to run.

#### options.workers

Type: `Integer`
Default value: `10`

Run number of workers.

#### options.force

Type: `Boolean`
Default value: `False`

Force rebuild.

#### options.verbosity

Type: `String`
Default value: `info`

Verbosity level (silly, verbose, info, warn, debug, error).

#### options.targets

Type: `String`
Default value: `target's name`

Build targets

### Usage Examples

#### Default Options

In this example, the default options are used to do build target `all` in the level `bem-project`. BEM is installed as a global package.

```js
grunt.initConfig({
bem: {
all: {
root: 'bem-project'
}
}
})
```

#### Custom Options

In this example, custom options are used to do build targets `desktop.bundles` and `touch.bundles`. BEM is installed as a local package.

```js
grunt.initConfig({
bem: {
options: {
require: 'bem-project/node_modules/bem',
root: 'bem-project'
},
'desktop.bundles touch.bundles': {
verbosity: 'warn'
},
}
})
```

#### Advanced Example

```js
grunt.initConfig({
watch: {
bem: {
files: ['bem-project/*.bundles/*/*.bemjson.js'],
tasks: ['bem:bundles'],
options: {
interrupt: true
}
}
},
bem: {
options: {
require: 'bem-project/node_modules/bem',
root: 'bem-project',
verbosity: 'warn'
},
'bundles': {
targets: 'desktop.bundles touch.bundles'
},
'bundles-forced': {
targets: 'desktop.bundles touch.bundles',
forced: true
}
}
});

grunt.registerTask('default', ['bem:bundles-forced']);
```

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

## Release History

* 2013-02-20 v0.1.0 First official release.
41 changes: 41 additions & 0 deletions package.json
@@ -0,0 +1,41 @@
{
"name": "grunt-fest",
"description": "Compile Fest templates",
"version": "0.1.0",
"homepage": "https://github.com/eprev/grunt-fest",
"author": {
"name": "Anton Eprev",
"email": "a.eprev@gmail.com"
},
"repository": {
"type": "git",
"url": "git://github.com/eprev/grunt-fest.git"
},
"bugs": {
"url": "https://github.com/eprev/grunt-fest/issues"
},
"licenses": [{
"type": "MIT",
"url": "https://github.com/eprev/grunt-fest/blob/master/LICENSE.md"
}],
"main": "Gruntfile.js",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt": "~0.4.0",
"fest": "~0.5.4"
},
"peerDependencies": {
"grunt": "~0.4.0"
},
"keywords": [
"gruntplugin", "fest"
]
}

0 comments on commit cadeb2c

Please sign in to comment.