cuba-assets 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2535541eb0d17dd270fb7c63fcaef458ac7f2f1d
4
- data.tar.gz: 2329e92f0d48bb7d6e41e1017c4ad2d48b05552c
3
+ metadata.gz: d54c3d4baebdd2a310acffa44a50486d9cb47607
4
+ data.tar.gz: bff41d88b31e7007f66d2343492bf6721246b445
5
5
  SHA512:
6
- metadata.gz: 00e3c3dc3a810f4181345f87605b93d8d137ceebaf384358a7256da37af3c210ac11beb130109983ea2e8cc7a20158c8cc93752f2be3a1781c7b55d58369997f
7
- data.tar.gz: e43d7bf45126ca07a7aa5ffe2f8ce16f38f08ba80feba69507a158cc7483ffaeb1b99edb5cbb85a22bd09ff73c668fa00b9e183b2486aa323d2f974a675511de
6
+ metadata.gz: e6fbf9475c455c564c411f4a619653fe9188c677ab4cebc70c8878bd04129a1b6060142f8057d02eda96ac871be1db20904f589d45fa14e20928f1d983ed08f6
7
+ data.tar.gz: 15ba5cc070a814a94d6a0394e6b7021f8b5116d62e0e1a3d483ac98ffb5d23f9f3df4bac60e4350ba59e468ea75ac46e0a551e02182eed3fab500a98c58fbbd6
data/README.md CHANGED
@@ -18,9 +18,41 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install cuba-assets
20
20
 
21
+ ## Why Cuba::Assets?
22
+
23
+ Adding Sprockets to Cuba isn't a hard task. It only takes a little boilerplate to get it set up.
24
+ This gem just takes that boilerplate out of sight.
25
+
21
26
  ## Usage
22
27
 
23
- TODO: Write usage instructions here
28
+ The first order of business is requiring the plugin and making it available.
29
+
30
+ ```ruby
31
+ require "cuba/assets"
32
+ Cuba.plugin Cuba::Assets
33
+ ```
34
+
35
+ This assumes that you have the following directories in place:
36
+
37
+ - `<assets_dir>/javascripts`
38
+ - `<assets_dir>/styles`
39
+ - `<assets_dir>/fonts`
40
+ - `<assets_dir>/images`
41
+
42
+ Where `<assets_dir>` is, by default: `<app_dir>/assets`
43
+
44
+ With that in place, you can now use the `asset` helper, passing the desired asset's path.
45
+ This will return an instance of `Sprockets::BundledAsset`.
46
+
47
+ ## Configurations
48
+
49
+ ### Changing the assets directory
50
+
51
+ To change the assets directory, just set it on the `settings` hash.
52
+
53
+ ```ruby
54
+ Cuba.settings[:assets][:js_compressor] = nil
55
+ ```
24
56
 
25
57
  ## Contributing
26
58
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "cuba-assets"
3
- spec.version = "0.0.5"
3
+ spec.version = "0.1.0"
4
4
  spec.authors = ["Federico Iachetti"]
5
5
  spec.email = ["iachetti.federico@gmail.com"]
6
6
  spec.summary = %q{Asset pipeline for Cuba.}
@@ -1,10 +1,12 @@
1
1
  require "pathname"
2
2
  require "sprockets"
3
3
 
4
- Cuba.settings[:assets_dir] = "assets/"
4
+ Cuba.settings[:assets] = {}
5
5
 
6
- Cuba.settings[:js_compressor] = :uglify
7
- Cuba.settings[:css_compressor] = :scss
6
+ Cuba.settings[:assets][:assets_dir] = "assets/"
7
+
8
+ Cuba.settings[:assets][:js_compressor] = :uglify
9
+ Cuba.settings[:assets][:css_compressor] = :scss
8
10
  module Cuba::Assets
9
11
  def asset(path)
10
12
  environment[path]
@@ -26,13 +28,13 @@ module Cuba::Assets
26
28
  environment.append_path "#{assets_dir}/fonts"
27
29
  environment.append_path "#{assets_dir}/images"
28
30
 
29
- environment.js_compressor = Cuba.settings[:js_compressor]
30
- environment.css_compressor = Cuba.settings[:css_compressor]
31
+ environment.js_compressor = Cuba.settings[:assets][:js_compressor]
32
+ environment.css_compressor = Cuba.settings[:assets][:css_compressor]
31
33
 
32
34
  environment
33
35
  end
34
36
 
35
37
  def assets_dir
36
- @assets_dir ||= Pathname(Cuba.settings[:assets_dir]).expand_path.to_s
38
+ @assets_dir ||= Pathname(Cuba.settings[:assets][:assets_dir]).expand_path.to_s
37
39
  end
38
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuba-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Iachetti