Skip to content

Commit

Permalink
Basic README
Browse files Browse the repository at this point in the history
  • Loading branch information
ismasan committed Nov 3, 2010
1 parent 27c55d1 commit b235015
Showing 1 changed file with 62 additions and 25 deletions.
87 changes: 62 additions & 25 deletions README.md
@@ -1,25 +1,62 @@

JBundle.config do

end


version 2
dist 'dist'

bundle :some_file do
file 'file1'
file 'file2
end

file 'file3'

filter do |src|
src.gsub /<VERSION>/, version
end

dist/2/some_file.js
dist/2/some_file.min.js
dist/2/file3.js
dist/2/file3.min.js

## JBundle (in progress)

Define a set of javascript files to bundle and minify

JBundle.config do
version '1.6.1'

src_dir File.dirname(__FILE__) + '/src'

bundle 'foo.js' do
file 'file1.js'
file 'file2.js'
end

bundle 'foo2.js' do
file 'file3.js'
file 'file4.js'
end

file 'file4.js'

file 'text.txt'
# Filters can be use for string substitution
filter do |src, config|
src.gsub!(/<VERSION>/, config.version)
end

end

Then write them to a directory

JBundle.write_to './dist'

This will write the following files:

'dist/1.6.1/foo.js'
'dist/1.6.1/foo.min.js'
'dist/1.6.1/foo2.js'
'dist/1.6.1/foo2.min.js'
'dist/1.6.1/file4.js'
'dist/1.6.1/file4.min.js'
'dist/1.6.1/text.txt'

'dist/1.6/foo.js'
'dist/1.6/foo.min.js'
'dist/1.6/foo2.js'
'dist/1.6/foo2.min.js'
'dist/1.6/file4.js'
'dist/1.6/file4.min.js'
'dist/1.6/text.txt'

Or you can build a single bundle/file dinamically (ie. for testing)

JBundle.build('foo.js').src

Or

JBundle.build('foo.js').min

All defined filters will run on the src for all these cases.

0 comments on commit b235015

Please sign in to comment.