Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build cleanup #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules/
node_modules/

# No reason to commit build files
dist/
61 changes: 44 additions & 17 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'

coffee:
# load all grunt tasks and not need to declare them at the end
require('matchdep').filterDev('grunt-*').forEach grunt.loadNpmTasks
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is awesome rad!


grunt.initConfig
pkg: grunt.file.readJSON 'package.json'

# basic watch tasks first for development
watch:
coffee:
files: [
'src/*.coffee'
]
tasks: 'coffee:compile'
options:
livereload: true

# lint our files to make sure we're keeping to team standards
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean you're including it as an internal library @ NatGeo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, part of standardizing. Makes working with PODs and third party code easier down the line.

coffeelint:
files:
src: ['src/<%= pkg.name %>.coffee']
options:
'indentation':
value: 4
level: 'warn'
'no_trailing_whitespace':
level: 'ignore'
'max_line_length':
velue: 120
level: 'warn'

coffee:
compile:
options:
sourceMap: true
sourceMap: true

files: [{
expand: true
cwd: 'src/'
src: ['**.coffee']
src: ['<%= pkg.name %>.coffee']
dest: 'dist/'
rename: (dest, src) ->
filename = "#{src.substring src.lastIndexOf('/'), src.length}"
Expand All @@ -32,6 +59,9 @@ module.exports = (grunt) ->
src:['dist/<%= pkg.name %>.js']
dest:'dist/<%= pkg.name %>.min.js'

# clear out any unneccessary files
clean: ['dist/*']

# https:#npmjs.org/package/grunt-include-replace
includereplace:
dist:
Expand All @@ -47,22 +77,25 @@ module.exports = (grunt) ->
suffix: ''

# Files to perform replacements and includes with
src: ['dist/<%= pkg.name %>.js', 'dist/<%= pkg.name %>.min.js', '*.html']
src: ['dist/<%= pkg.name %>.js', 'dist/<%= pkg.name %>.min.js', 'src/<%= pkg.name %>.html']

# Destinaion directory to copy files to
dest: 'dist/'

dev:
options:

# Global variables available in all files
globals:
version: '<%= pkg.version %>'
date: '<%= grunt.template.today("yyyy/mm/dd") %>'
earsjs: '<%= pkg.name %>.js'

# Files to perform replacements and includes with
src: ['dist/<%= pkg.name %>.js', 'dist/<%= pkg.name %>.min.js', '*.html']
src: ['dist/<%= pkg.name %>.js', 'dist/<%= pkg.name %>.min.js', 'src/<%= pkg.name %>.html']

# Destinaion directory to copy files to
dest: 'dist/'

yuidoc:
compile:
name: '<%= pkg.name %>'
Expand All @@ -73,11 +106,5 @@ module.exports = (grunt) ->
paths: 'dist/'
outdir: 'docs/'


grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-include-replace'
grunt.loadNpmTasks 'grunt-contrib-yuidoc'

grunt.registerTask 'dev',['coffee:compile','uglify:dist', 'includereplace:dev', 'yuidoc:compile']
grunt.registerTask 'default',['coffee:compile','uglify:dist', 'includereplace:dist', 'yuidoc:compile']
grunt.registerTask 'dev',['clean', 'coffeelint', 'coffee:compile', 'includereplace:dev']
grunt.registerTask 'default',['clean', 'coffee:compile', 'uglify:dist', 'includereplace:dist', 'yuidoc:compile']
256 changes: 0 additions & 256 deletions dist/ears.js

This file was deleted.

10 changes: 0 additions & 10 deletions dist/ears.js.map

This file was deleted.

Loading