angular-rails-templates 0.1.5 → 0.2.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: 424d832bc1a897b8b1989d2025f181ad24c4e68d
4
- data.tar.gz: 762385893bab1c50684b8b454f7762146af5c684
3
+ metadata.gz: a018691c75509ff84ca02b0939e0db6c823344b4
4
+ data.tar.gz: 47ef3eb43c11466504e92b9432de1a5c2ee28b62
5
5
  SHA512:
6
- metadata.gz: f50a43ca0b89cb170ae354828bd2cd81218cf822dd6a2785f991c8417378d9cad01d3745b74d0a77465fc3834f7bd0a06378c336adcb54a81724fa0254d182d9
7
- data.tar.gz: ccd9c62b94929cb6ab0e2571ae1e7bb755e1f1126401788c8878643350c9110f69f5be1b947a9265cbea65b723199528e3b873571c620db6311758db62e30261
6
+ metadata.gz: 5e6b454369e855905ed02a39c734e43ff24243d8e9c995f889f78f0304d9e8195c398ad79400e18ada1793cf1a8c174435e708c4019af1ab1681de042bd9297d
7
+ data.tar.gz: f5e21a3e7b5d8cb9c8a154f18a4547a05e81dc101999a74f7ee631e54b59ecd26c9d4b6448e2a8ed1f7312387e08fbb7bb1648a9cf2ee2842f33ee7e5f535786
data/README.md CHANGED
@@ -103,6 +103,7 @@ Here are their default values:
103
103
  # config/application.rb
104
104
  config.angular_templates.module_name = 'templates'
105
105
  config.angular_templates.ignore_prefix = %w(templates/)
106
+ config.angular_templates.inside_paths = [Rails.root.join('app', 'assets')]
106
107
  config.angular_templates.markups = %w(erb str haml slim md)
107
108
  config.angular_templates.htmlcompressor = false
108
109
  ```
@@ -155,6 +156,11 @@ You can set `config.angular_templates.ignore_prefix` to change the default ignor
155
156
  ```
156
157
 
157
158
 
159
+ ### Configuration Option: `inside_paths`
160
+
161
+ Templates only from paths matched by `inside_paths` will be used. By default anything under app/assets can be templates. This option is useful if you are using this gem inside an engine. Also useful if you DON'T want some files to be processed by this gem (see issue #88)
162
+
163
+
158
164
  ### Configuration Option: `markups`
159
165
 
160
166
  Any markup that Tilt supports can be used, but you may need to add a gem to your Gemfile. See [Tilt](https://github.com/rtomayko/tilt) for a list of the supported markups and required libraries.
@@ -5,10 +5,13 @@ module AngularRailsTemplates
5
5
  config.angular_templates = ActiveSupport::OrderedOptions.new
6
6
  config.angular_templates.module_name = 'templates'
7
7
  config.angular_templates.ignore_prefix = ['templates/']
8
+ config.angular_templates.inside_paths = [] # defined in before_configuration
8
9
  config.angular_templates.markups = []
9
10
  config.angular_templates.htmlcompressor = false
10
11
 
11
12
  config.before_configuration do |app|
13
+ config.angular_templates.inside_paths = [Rails.root.join('app', 'assets')]
14
+
12
15
  # try loading common markups
13
16
  %w(erb haml liquid md radius slim str textile wiki).
14
17
  each do |ext|
@@ -11,10 +11,10 @@ module AngularRailsTemplates
11
11
  end
12
12
 
13
13
  def prepare
14
- # we only want to process html assets inside Rails.root/app/assets
15
- @asset_inside_rails_root = file.match "#{Rails.root.join 'app', 'assets'}"
14
+ # we only want to process html assets inside those specified in configuration.inside_paths
15
+ @asset_should_be_processed = configuration.inside_paths.any? { |folder| file.match(folder.to_s) }
16
16
 
17
- if configuration.htmlcompressor and @asset_inside_rails_root
17
+ if configuration.htmlcompressor and @asset_should_be_processed
18
18
  @data = compress data
19
19
  end
20
20
  end
@@ -25,7 +25,7 @@ module AngularRailsTemplates
25
25
  locals[:source_file] = "#{scope.pathname}".sub(/^#{Rails.root}\//,'')
26
26
  locals[:angular_module] = configuration.module_name
27
27
 
28
- if @asset_inside_rails_root
28
+ if @asset_should_be_processed
29
29
  AngularJsTemplateWrapper.render(scope, locals)
30
30
  else
31
31
  data
@@ -1,3 +1,3 @@
1
1
  module AngularRailsTemplates
2
- VERSION = '0.1.5'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular-rails-templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Mathieu
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-28 00:00:00.000000000 Z
13
+ date: 2015-04-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties