Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
RuochenLyu committed Oct 10, 2014
1 parent 0ce68a8 commit e07402e
Show file tree
Hide file tree
Showing 12 changed files with 576 additions and 363 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
source 'http://ruby.taobao.org'

gem 'sass'
gem 'coffee-script'
gem 'sass', '>= 3.4.0'
10 changes: 2 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
GEM
remote: http://ruby.taobao.org/
specs:
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
execjs (2.0.2)
sass (3.3.4)
sass (3.4.5)

PLATFORMS
ruby

DEPENDENCIES
coffee-script
sass
sass (>= 3.4.0)
59 changes: 39 additions & 20 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,74 @@ module.exports = (grunt) ->

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


sass:
gallery:
styles:
options:
style: 'expanded'
bundleExec: true
style: 'expanded'
sourcemap: 'none'
files:
'lib/gallery.css': 'src/gallery.scss'
'styles/gallery.css': 'styles/gallery.scss'

coffee:
gallery:
src:
options:
bare: true
files:
'lib/gallery.js': 'src/gallery.coffee'
spec:
files:
'spec/gallery-spec.js': 'spec/gallery-spec.coffee'

umd:
all:
src: 'lib/gallery.js'
template: 'umd.hbs'
amdModuleId: 'simple-gallery'
objectToExport: 'gallery'
globalAlias: 'gallery'
deps:
'default': ['$', 'SimpleModule']
amd: ['jquery', 'simple-module']
cjs: ['jquery', 'simple-module']
global:
items: ['jQuery', 'SimpleModule']
prefix: ''

watch:
styles:
files: ['src/*.scss']
files: ['styles/*.scss']
tasks: ['sass']
scripts:
files: ['src/*.coffee', 'spec/*.coffee']
tasks: ['coffee']
spec:
files: ['spec/**/*.coffee']
tasks: ['coffee:spec']
src:
files: ['src/**/*.coffee']
tasks: ['coffee:src', 'umd']
jasmine:
files: [
'lib/gallery.css',
'lib/gallery.js',
'specs/*.js'
],
files: ['lib/**/*.js', 'specs/**/*.js']
tasks: 'jasmine:test:build'

jasmine:
test:
src: ['lib/gallery.js']
src: ['lib/**/*.js']
options:
outfile: 'spec/index.html'
styles: 'lib/gallery.css'
styles: 'styles/gallery.css'
specs: 'spec/gallery-spec.js'
vendor: [
'vendor/bower/jquery/dist/jquery.min.js',
'vendor/bower/simple-module/lib/module.js',
'vendor/bower/jquery/dist/jquery.min.js'
'vendor/bower/simple-module/lib/module.js'
'vendor/bower/simple-util/lib/util.js'
]

grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-jasmine'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-umd'

grunt.registerTask 'default', ['sass', 'coffee', 'umd', 'jasmine:test:build', 'watch']



grunt.registerTask 'default', ['coffee', 'jasmine:test:build', 'watch']
14 changes: 9 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@
"authors": [
"kshift <[email protected]>"
],
"description": "a simple gallery ui widget",
"description": "a simple gallery widget based on Simple Module",
"main": "lib/gallery.min.js",
"keywords": [
"gallery"
],
"license": "MIT",
"ignore": [
"**/.*",
"spec",
"node_modules",
"vendor",
"Gemfile",
"Gemfile.lock",
"Gruntfile.coffee",
"package.json",
"README"
"README.md",
"umd.hbs"
],
"dependencies": {
"jquery": "~2.1.0",
"jquery": "2.x",
"fontawesome": "~4.0.3",
"simple-module": "master",
"simple-util": "master"
"simple-module": "2.x",
"simple-util": "1.x"
}
}
2 changes: 1 addition & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8" />

<link media="all" rel="stylesheet" type="text/css" href="vendor/bower/fontawesome/css/font-awesome.min.css" />
<link media="all" rel="stylesheet" type="text/css" href="lib/gallery.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/gallery.css" />
<style type="text/css" media="all">
body {
margin: 0;
Expand Down
Loading

0 comments on commit e07402e

Please sign in to comment.