Skip to content

Commit

Permalink
Make meteor listen for changes on json files
Browse files Browse the repository at this point in the history
  • Loading branch information
André Neves committed Apr 3, 2015
1 parent 0957328 commit 65e20e8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
andrefgneves:[email protected].6
andrefgneves:[email protected].7
[email protected]
[email protected]
[email protected]
Expand All @@ -11,7 +11,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
local-test:andrefgneves:[email protected].6
local-test:andrefgneves:[email protected].7
[email protected]
[email protected]
[email protected]
Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ Type: `array` Default: `[ 'svg', 'ttf', 'eot', 'woff' ]`

The types of fonts to generate.

#### stylesheetTemplatePath

Type: `string` Default: `packages/iconfont/plugin/stylesheet.tpl`

The path to the stylesheet template. This file must have a [Lodash's template](http://lodash.com/docs#template) compatible syntax.

#### fontHeight

Type: `number` Default: `512`
Expand All @@ -59,7 +53,7 @@ The height of the outputed fonts.

Type: `string` Default: `client`

Path where the generated stylesheet should be outputed.
Path where the generated stylesheet should be outputed to.

#### stylesheetFilename

Expand All @@ -77,7 +71,7 @@ The path to a Lodash template

Type: `object` Default: null

An object that defined which files to generate and with what templates. If specified, `stylesheetFilename` and `stylesheetTemplate` are ignored.
An object that defined which files to generate and with what templates. If specified, `stylesheetFilename` and `stylesheetTemplate` are ignored.

Example for a possible usecase where you want the icons `content` value to be specified in a SASS map, and to access those variables in the icons selectors:

Expand All @@ -88,7 +82,7 @@ Example for a possible usecase where you want the icons `content` value to be sp
}
```

This would create `_icon-classes.scss` and `_icon-variables.scss` at `stylesheetDestBasePath` with the contents of the respective compiled template.
This would create `_icon-classes.scss` and `_icon-variables.scss` at `stylesheetDestBasePath` with the contents of the respective compiled template.


`_icon-variables.scss`
Expand Down Expand Up @@ -142,4 +136,4 @@ Normalize icons by scaling them to the `fontHeight` value.

## License

The MIT License, see the included License.txt file.
The MIT License, see the included License.txt file.
4 changes: 2 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package.describe({
summary: 'Generate an icon font from SVG files',
version: '0.1.6',
version: '0.1.7',
git: 'https://github.com/andrefgneves/meteor-iconfont.git',
name: 'andrefgneves:iconfont'
});

Package.registerBuildPlugin({
name: 'andrefgneves:iconfont',

use: ['coffeescript@1.0.5'],
use: ['coffeescript'],

sources: [
'plugin/iconfont.coffee'
Expand Down
13 changes: 11 additions & 2 deletions plugin/iconfont.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ handler = (compileStep) ->
normalize: true
classPrefix: 'icon-'
stylesheetFilename: null
stylesheetTemplate: '.meteor/local/isopacks/andrefgneves_iconfont/os/packages/andrefgneves:iconfont/plugin/stylesheet.tpl'
stylesheetTemplate: '.meteor/local/isopacks/andrefgneves_iconfont/os/packages/andrefgneves_iconfont/plugin/stylesheet.tpl'
types: [
'svg'
'ttf'
Expand Down Expand Up @@ -232,7 +232,13 @@ generateStylesheets = (compileStep, options) ->
stylesheets = options.stylesheets

for fileName, filePath of stylesheets
template = fs.readFileSync path.join(process.cwd(), filePath), 'utf8'
templatePath = path.join process.cwd(), filePath

if not fs.existsSync templatePath
console.log "\n[iconfont] template file not found at #{templatePath}"
continue

template = fs.readFileSync templatePath, 'utf8'

data = _.template template,
glyphCodepointMap: glyphCodepointMap
Expand Down Expand Up @@ -288,5 +294,8 @@ loadJSONFile = (filePath) ->

{}

# Make meteor listen for changes on json files
Plugin.registerSourceHandler 'json', archMatching: 'web', ->

Plugin.registerSourceHandler 'iconfont.json', archMatching: 'web', handler
Plugin.registerSourceHandler 'svg', archMatching: 'web', handler
2 changes: 1 addition & 1 deletion smart.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"description": "Generate an icon font from SVG files",
"homepage": "https://github.com/andrefgneves/meteor-iconfont",
"author": "Andre Neves (https://twitter.com/seven)",
"version": "0.1.6",
"version": "0.1.7",
"git": "https://github.com/andrefgneves/meteor-iconfont.git"
}

0 comments on commit 65e20e8

Please sign in to comment.