This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from mobify/bellows-2.0
Bellows 2.0
- Loading branch information
Showing
131 changed files
with
16,831 additions
and
897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
.DS_Store | ||
node_modules/ | ||
localConfig.json | ||
build/bellows.zip | ||
build/bellows-style.css | ||
build/bellows.css | ||
build/bellows.js | ||
bower_components/ | ||
.DS_Store | ||
/.sass-cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,55 @@ | ||
'use strict' | ||
|
||
var path = require('path'); | ||
|
||
module.exports = function(grunt) { | ||
var _ = grunt.util._; | ||
|
||
// By default, we load all local tasks from the tasks directory. | ||
grunt.file.expand('tasks/*').forEach(function(task) { | ||
grunt.loadTasks(task); | ||
}); | ||
|
||
// Populate the config object | ||
var config = {}; | ||
grunt.file.expand('tasks/config/*').forEach(function(configPath) { | ||
// Get the grunt-task name to put in the config which is based on the | ||
// name of the config file | ||
var configName = configPath.match(/\/([^\/]*)\.js/)[1]; | ||
var option = require(path.join(__dirname + '/' + configPath))(grunt); | ||
config[configName] = _.extend(config[configName] || {}, option); | ||
}); | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
grunt.initConfig(_.extend({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
localConfig: (function(){ | ||
try { | ||
return grunt.file.readJSON('localConfig.json') | ||
} catch(e) { | ||
return {}; | ||
} | ||
})(), | ||
releaseName: '<%= pkg.name %>-<%= pkg.version %>', | ||
releaseMessage: '<%= pkg.name %> release <%= pkg.version %>', | ||
clean: { | ||
buildProducts: "build/" | ||
}, | ||
connect: { | ||
server: { | ||
options: { | ||
hostname: '0.0.0.0', | ||
port: 3000, | ||
base: '.' | ||
} | ||
} | ||
}, | ||
watch: { | ||
files: ["src/**/*"], | ||
tasks: ['build'] | ||
}, | ||
copy: { | ||
main: { | ||
files: [ | ||
{expand: true, flatten: true, src: ['src/**'], dest: 'build/', filter: 'isFile'} | ||
] | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | ||
}, | ||
build: { | ||
src: 'src/bellows.js', | ||
dest: 'build/bellows.min.js' | ||
} | ||
}, | ||
cssmin: { | ||
core: { | ||
src: 'src/bellows.css', | ||
dest: 'build/bellows.min.css' | ||
}, | ||
style: { | ||
src: 'src/bellows-style.css', | ||
dest: 'build/bellows-style.min.css' | ||
} | ||
}, | ||
zip: { | ||
"build/bellows.zip": ["src/bellows.js", "src/bellows.css", | ||
"src/bellows-style.css"] | ||
}, | ||
s3: { | ||
key: '<%= localConfig.aws.key %>', | ||
secret: '<%= localConfig.aws.secret %>', | ||
bucket: '<%= localConfig.aws.bucket %>', | ||
access: "public-read", | ||
headers: { "Cache-Control": "max-age=1200" }, | ||
upload: [ | ||
{ // build | ||
src: "build/*", | ||
dest: "modules/bellows/<%= pkg.version %>/", | ||
rel: "build" | ||
} | ||
] | ||
}, | ||
release: { | ||
options: { | ||
folder: '.', | ||
npm: false, | ||
bump: false, | ||
add: false, | ||
commit: false, | ||
file: 'bower.json', | ||
github: { | ||
repo: 'mobify/bellows', | ||
usernameVar: 'GITHUB_USERNAME', | ||
passwordVar: 'GITHUB_TOKEN' | ||
} | ||
} | ||
} | ||
}); | ||
releaseMessage: '<%= pkg.name %> release <%= pkg.version %>' | ||
}, config)); | ||
|
||
// Load the task plugins | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
grunt.loadNpmTasks('grunt-css'); | ||
grunt.loadNpmTasks('grunt-shell'); | ||
grunt.loadNpmTasks('grunt-zip'); | ||
grunt.loadNpmTasks('grunt-s3'); | ||
grunt.loadNpmTasks('grunt-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-release'); | ||
// load npm tasks | ||
var npmTasks = [ | ||
'grunt-contrib-uglify', | ||
'grunt-contrib-watch', | ||
'grunt-contrib-connect', | ||
'grunt-css', | ||
'grunt-shell', | ||
'grunt-contrib-clean', | ||
'grunt-contrib-copy', | ||
'grunt-autoprefixer', | ||
'grunt-contrib-sass', | ||
'grunt-mocha-phantomjs' | ||
]; | ||
|
||
// Default task(s). | ||
grunt.registerTask('serve', ['connect', 'watch']); | ||
grunt.registerTask('build', ['copy', 'uglify', 'cssmin', 'zip']); | ||
grunt.registerTask('publish', ['build', 'release', 's3']) | ||
grunt.registerTask('default', 'build'); | ||
npmTasks.forEach(function(taskName) { | ||
if (!grunt.task._tasks[taskName]) { | ||
grunt.loadNpmTasks(taskName); | ||
} | ||
}); | ||
|
||
grunt.registerTask('serve', ['build-dist', 'connect:server', 'watch']); | ||
grunt.registerTask('build-dist', ['copy', 'uglify', 'sass', 'autoprefixer', 'cssmin']); | ||
grunt.registerTask('release', ['test', 'shell:tagRelease']); | ||
grunt.registerTask('test', ['build-dist', 'connect:test', 'mocha_phantomjs']); | ||
grunt.registerTask('test:browser', ['build-dist', 'connect:test:keepalive']); | ||
grunt.registerTask('default', 'build-dist'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.