├── .gitignore
├── package.json
├── autopublish.json
├── .versions
├── package.js
├── README.md
├── tests
└── tests.js
└── gulpfile.js
/.gitignore:
--------------------------------------------------------------------------------
1 | upstream
2 | node_modules
3 | phantom_runner.js
4 | start_test.js
5 | npm-debug.log
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "devDependencies": {
3 | "del": "^1.1.1",
4 | "gulp-download": "0.0.1",
5 | "gulp-git": "^1.2.1",
6 | "gulp-replace": "^0.5.3",
7 | "gulp-util": "^3.0.4",
8 | "gulp": "^3.8.11",
9 | "run-sequence": "^1.1.0"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/autopublish.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "4.7.0",
3 | "upstream": {
4 | "git": "https://github.com/FortAwesome/Font-Awesome.git",
5 | "release": "v4.7.0",
6 | "versionFile": "package.json"
7 | },
8 | "hook": {
9 | "repoFullName": "FortAwesome/Font-Awesome"
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.versions:
--------------------------------------------------------------------------------
1 | babel-compiler@5.8.24_1
2 | babel-runtime@0.1.4
3 | base64@1.0.4
4 | binary-heap@1.0.4
5 | blaze@2.1.3
6 | blaze-tools@1.0.4
7 | boilerplate-generator@1.0.4
8 | callback-hook@1.0.4
9 | check@1.1.0
10 | ddp@1.2.2
11 | ddp-client@1.2.1
12 | ddp-common@1.2.2
13 | ddp-server@1.2.2
14 | deps@1.0.9
15 | diff-sequence@1.0.1
16 | ecmascript@0.1.6
17 | ecmascript-runtime@0.2.6
18 | ejson@1.0.7
19 | fortawesome:fontawesome@4.6.3
20 | geojson-utils@1.0.4
21 | html-tools@1.0.5
22 | htmljs@1.0.5
23 | http@1.1.1
24 | id-map@1.0.4
25 | jquery@1.11.4
26 | local-test:fortawesome:fontawesome@4.6.3
27 | logging@1.0.8
28 | meteor@1.1.10
29 | minimongo@1.0.10
30 | mongo@1.1.3
31 | mongo-id@1.0.1
32 | npm-mongo@1.4.39_1
33 | observe-sequence@1.0.7
34 | ordered-dict@1.0.4
35 | promise@0.5.1
36 | random@1.0.5
37 | reactive-var@1.0.6
38 | retry@1.0.4
39 | routepolicy@1.0.6
40 | spacebars@1.0.7
41 | spacebars-compiler@1.0.7
42 | test-helpers@1.0.5
43 | tinytest@1.0.6
44 | tracker@1.0.9
45 | ui@1.0.8
46 | underscore@1.0.4
47 | url@1.0.5
48 | webapp@1.2.3
49 | webapp-hashing@1.0.5
50 |
--------------------------------------------------------------------------------
/package.js:
--------------------------------------------------------------------------------
1 | Package.describe({
2 | name: 'fortawesome:fontawesome',
3 | summary: 'Font Awesome (official): 500+ scalable vector icons, customizable via CSS, Retina friendly',
4 | version: '4.7.0',
5 | git: 'https://github.com/MeteorPackaging/Font-Awesome.git',
6 | documentation: 'README.md'
7 | });
8 |
9 |
10 | Package.onUse(function(api) {
11 | api.versionsFrom('1.2.1');
12 |
13 | api.addAssets([
14 | // we bundle all font files, but the client will request only one of them via the CSS @font-face rule
15 | 'upstream/fonts/fontawesome-webfont.eot', // IE8 or older only understands EOT. IE9+ will read it too because it loads the first occurrence of `src`
16 | 'upstream/fonts/fontawesome-webfont.svg', // SVG fallback for iOS < 5 - http://caniuse.com/#feat=svg-fonts, http://stackoverflow.com/a/11002874/1269037
17 | 'upstream/fonts/fontawesome-webfont.ttf', // Android Browers 4.1, 4.3 - http://caniuse.com/#feat=ttf
18 | 'upstream/fonts/fontawesome-webfont.woff', // Most modern browsers
19 | 'upstream/fonts/fontawesome-webfont.woff2', // Chrome 36+, Opera 23+; improves compression
20 | 'upstream/fonts/FontAwesome.otf',
21 | ], 'client');
22 |
23 | api.addFiles([
24 | 'upstream/css/font-awesome.css'
25 | ], 'client');
26 | });
27 |
28 |
29 | Package.onTest(function(api) {
30 | api.use('fortawesome:fontawesome');
31 |
32 | api.use([
33 | 'http',
34 | 'tinytest',
35 | 'test-helpers'
36 | ], ['client']);
37 |
38 | api.add_files([
39 | 'tests/tests.js',
40 | ], ['client']);
41 | });
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [Font Awesome](http://fontawesome.io/) packaged for [Meteor.js](http://meteor.com).
2 |
3 | Please note that starting with Meteor 1.3, you should be using npm packages directly.
4 |
5 | Wrapper packages such as this one are now obsolete.
6 |
7 | # Usage
8 |
9 | Just run `meteor add fortawesome:fontawesome` in your project, then use the standard Font Awesome markup:
10 |
11 | Home
12 |
13 |
14 | # Issues
15 |
16 | If you encounter an issue while using this package, please CC @dandv when you file it in this repo.
17 |
18 |
19 | # Building
20 |
21 | 1. `npm install` (or just `yarn`)
22 | 2. Edit `autopublish.json` and update the version number.
23 | 3. `node_modules/.bin/gulp getUpstream`
24 | 4. `node_modules/.bin/gulp updateVersion`
25 |
26 | Now you can commit the updated `package.js` and `autopublish.json` (even though the latter is no longer useful after the [decommission of autopublish](https://github.com/MeteorPackaging/autopublish.meteor.com/issues/27)).
27 |
28 | To test Font Awesome interactively, run
29 |
30 | node_modules/.bin/gulp test
31 |
32 |
33 | # DONE
34 |
35 | * No need for CSS override files - Meteor will automatically "convert relative URLs to absolute URLs when merging CSS files" [since v0.8.1](https://github.com/meteor/meteor/blob/b96c5d7962a9e59b9efaeb93eb81020e0548e378/History.md#v081) so CSS `@font-face src url('../fonts/...')` will be resolved to the correct `/packages/.../fonts/...` path
36 | * Tests that fonts are downloadable: EOT, SVG, TTF, WOFF, WOFF2
37 | * Visual check
38 |
39 |
40 | # TODO
41 |
42 | * [Read the `src/test.html` file into the test directly](http://stackoverflow.com/questions/27180892/pull-an-html-file-into-a-tinytest) instead of via rawgit - how to do this with TinyTest?
43 |
--------------------------------------------------------------------------------
/tests/tests.js:
--------------------------------------------------------------------------------
1 | /* global
2 | document: false,
3 | HTTP: false,
4 | Tinytest: false
5 | */
6 | 'use strict';
7 |
8 | var fontAssets = [
9 | 'fontawesome-webfont.eot',
10 | 'fontawesome-webfont.svg',
11 | 'fontawesome-webfont.ttf',
12 | 'fontawesome-webfont.woff',
13 | 'fontawesome-webfont.woff2',
14 | 'FontAwesome.otf',
15 | ];
16 |
17 | // Check that the font files are downloadable. Meteor places assets at /packages//.
18 | fontAssets.forEach(function (filename) {
19 | Tinytest.addAsync(filename + ' font is shipped', function (test, done) {
20 | var path = '/packages/fortawesome_fontawesome/upstream/fonts/' + filename;
21 | HTTP.get(path, function callback(error, result) {
22 | if (error) {
23 | test.fail({message: 'Font failed to load'});
24 | }
25 | else {
26 | var errStr = filename + ' font could not be downloaded';
27 | test.isTrue(result.content.length > 1000, errStr);
28 | }
29 | done();
30 | });
31 | });
32 | })
33 | ;
34 |
35 |
36 | // Visual check.
37 | // Fonts are set by font-awesome.css in @font-face { src: url('../fonts/...') }.
38 | // TODO How does Meteor find those occurrences in the source and resolve them
39 | // to /packages//fonts/... ?
40 | Tinytest.addAsync('Visual check', function (test, done) {
41 | var iconsDropZone = document.createElement('div');
42 | document.body.appendChild(iconsDropZone);
43 |
44 |
45 | // TODO ideally we'd get src/test.html straight from this repo, but no idea
46 | // how to do this from TinyTest
47 | HTTP.get('http://rawgit.com/FortAwesome/Font-Awesome/master/src/test.html', function callback(error, result) {
48 | if (error) {
49 | test.fail('Error getting the icons. Do we have an Internet connection to rawgit.com?');
50 | } else {
51 | // [^] matches across newlines. Exclude the Stacked Icons section and below, because they transclude some other HTML.
52 | iconsDropZone.innerHTML = result.content.match(/Stacked)/);
53 | test.ok({message: 'Test passed if the icons look OK.'});
54 | }
55 |
56 | done();
57 | });
58 |
59 | });
60 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var
2 | autopublish = require('./autopublish.json'),
3 | del = require('del'),
4 | download = require("gulp-download"),
5 | fs = require('fs'),
6 | git = require('gulp-git'),
7 | gulp = require('gulp'),
8 | gutil = require('gulp-util'),
9 | replace = require('gulp-replace'),
10 | runSequence = require('run-sequence')
11 | ;
12 |
13 | // Clone the upstream repo
14 | // optional parameter: --tag
15 | gulp.task('getUpstream', function(){
16 | return del(['upstream'], function(err){
17 | if (err) throw err;
18 | console.log("cloning " + autopublish.upstream.git);
19 | git.clone(autopublish.upstream.git, {args: ' --recursive upstream'}, function (err) {
20 | if (err) throw err;
21 | var
22 | release = autopublish.upstream.release,
23 | tag = gutil.env.tag || release,
24 | path = __dirname + '/upstream/'
25 | ;
26 | console.log('checking out ' + tag);
27 | return git.checkout(tag, {cwd: path}, function (err) {
28 | if (err) throw err;
29 | git.status({cwd: path}, function (err) {
30 | if (err) throw err;
31 | });
32 | });
33 | });
34 | });
35 | });
36 |
37 |
38 | // Picks up current version of upstream repo and updates
39 | // 'package.js' and 'autopublish.json' accordingly
40 | gulp.task('updateVersion', function() {
41 | var
42 | versionFile = autopublish.upstream.versionFile,
43 | path = './upstream/' + versionFile
44 | ;
45 |
46 | return fs.readFile(path, 'utf8', function (err, content) {
47 | if (err) throw err;
48 |
49 | var
50 | versionRegexp = /(version?\"?\s?=?\:?\s[\'\"])([\d\.]*)([\'\"])/gi,
51 | match = versionRegexp.exec(content),
52 | version
53 | ;
54 | if (match && match.length === 4) {
55 | version = match[2];
56 | }
57 | else if (gutil.env.tag) {
58 | version = gutil.env.tag;
59 | }
60 | else {
61 | throw 'Unable to extract current version!';
62 | }
63 | console.log('Verision: ' + version);
64 | gulp.src(['package.js', 'autopublish.json'])
65 | .pipe(replace(versionRegexp, '$1' + version + '$3'))
66 | .pipe(gulp.dest('./'));
67 | });
68 | });
69 |
70 | // Stores latest published release into 'autopublish.json'
71 | gulp.task('updateRelease', function() {
72 | var tag = gutil.env.tag;
73 | if (!tag) throw 'no tag parameter provided!';
74 | console.log('Release: ' + tag);
75 |
76 | var versionRegexp = /(release?\"?\s?=?\:?\s[\'\"])(.*)([\'\"])/gi;
77 | return gulp.src(['autopublish.json'])
78 | .pipe(replace(versionRegexp, '$1' + tag + '$3'))
79 | .pipe(gulp.dest('./'));
80 | });
81 |
82 |
83 | // Donwload scripts necessary to run tests
84 | // Thanks @aronuda for providing them!
85 | // https://github.com/arunoda/travis-ci-meteor-packages
86 | gulp.task('setuptests', function(){
87 | return download([
88 | 'https://raw.github.com/arunoda/travis-ci-meteor-packages/master/start_test.js',
89 | 'https://raw.github.com/arunoda/travis-ci-meteor-packages/master/phantom_runner.js',
90 | ]).pipe(gulp.dest("./"));
91 | });
92 |
93 |
94 | // Actually run tests
95 | // NOTE: phantomjs must be available on the system
96 | gulp.task('runtests', function(){
97 | var
98 | spawn = require('child_process').spawn,
99 | tests = spawn('node', ['start_test'])
100 | ;
101 |
102 | tests.stdout.pipe(process.stdout);
103 | tests.stderr.pipe(process.stderr);
104 | tests.on('close', function(code) {
105 | process.exit(code);
106 | });
107 |
108 | return tests;
109 | });
110 |
111 |
112 | // Task to be used to test the package
113 | gulp.task('test', function(){
114 | runSequence('setuptests', 'runtests');
115 | });
116 |
--------------------------------------------------------------------------------