sprockets-commoner 0.2.8 → 0.3.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: 4a2a4e5d2440a8ed522f71f4d7bcfd23e6a51b21
4
- data.tar.gz: 935ba15297c44eb9b83bd00f829d185f5aa0363b
3
+ metadata.gz: 1200dc7cccf599784642963b195556c816321e6b
4
+ data.tar.gz: 8e8171388710041409ac93b542f79fa302c9dc93
5
5
  SHA512:
6
- metadata.gz: 09d56047331034979a9ca533aab2e1efb4ad8602b3fdb71d6e5c0031dbcbf610df9b1214045e4919de597c6b3ada7d6498ae5117e655ccd9540e8da12b2ad502
7
- data.tar.gz: 8b215f95572d7073e9e3b4e5d238dca06f6b0cb04fcfd8ed912b026045e9d3b2d998487e42f17537dcc57bac16d37fc438042f3a3ad91405b9213a1b64f9b24c
6
+ metadata.gz: 19c1680fabbf91d9847104149d656a31e160272d9ac902f5ff046079a17bfeda60ca99115d9790cd1874050660133fd8fa8caddb382d0b1f7ba1110060556b09
7
+ data.tar.gz: 273b85d3a6243d78cff1a7c35e51e9c72627577d533b45d13a8bd93d3daaff8004d5d2629b75d4fafc8af4ad9b2e39161a4fed46a41f3cd803c672c025e333b6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.0
4
+
5
+ * Added `Sprockets::Commoner::Processor.configure` method to simplify setup.
6
+
3
7
  ## v0.2.8
4
8
 
5
9
  * Modified the `cache_key` method of processor to not spin up a node process, but instead read the package.json directly.
data/README.md CHANGED
@@ -55,9 +55,7 @@ By default, commoner will process any file under the application root directory.
55
55
  ```ruby
56
56
  # In config/initializers/sprockets_commoner.rb
57
57
  Rails.application.config.assets.configure do |env|
58
- env.unregister_postprocessor('application/javascript', Sprockets::Commoner::Processor)
59
- env.register_postprocessor('application/javascript', Sprockets::Commoner::Processor.new(
60
- env.root,
58
+ Sprockets::Commoner::Processor.configure(env,
61
59
  # include, exclude, and babel_exclude patterns can be path prefixes or regexes.
62
60
  # Explicitely list paths to include. The default is `[env.root]`
63
61
  include: ['app/assets/javascripts/subdirectory'],
@@ -66,7 +64,7 @@ Rails.application.config.assets.configure do |env|
66
64
  # Anything listed in babel_exclude has its require calls resolved, but no transforms listed in .babelrcs applied.
67
65
  # Default is [/node_modules/]
68
66
  babel_exclude: [/node_modules/]
69
- ))
67
+ )
70
68
  end
71
69
  ```
72
70
 
@@ -32,7 +32,6 @@ var global = window;
32
32
  JS
33
33
 
34
34
  OUTRO = <<-JS.freeze
35
-
36
35
  }();
37
36
  JS
38
37
  def self.instance(env)
@@ -47,6 +47,15 @@ module Sprockets
47
47
  instance(input[:environment]).call(input)
48
48
  end
49
49
 
50
+ def self.configure(env, *args, **kwargs)
51
+ env.postprocessors['application/javascript'].each do |processor|
52
+ if processor == self || processor.is_a?(self)
53
+ env.unregister_postprocessor('application/javascript', processor)
54
+ end
55
+ end
56
+ env.register_postprocessor('application/javascript', self.new(env.root, *args, **kwargs))
57
+ end
58
+
50
59
  attr_reader :include, :exclude, :babel_exclude
51
60
  def initialize(root, include: [root], exclude: ['vendor/bundle'], babel_exclude: [/node_modules/])
52
61
  @root = root
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Commoner
3
- VERSION = '0.2.8'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-commoner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bouke van der Bijl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-15 00:00:00.000000000 Z
11
+ date: 2016-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.5.1
187
+ rubygems_version: 2.4.5.1
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Use Babel in Sprockets to compile modules for the browser