turbo-sprockets-rails3 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +11 -4
- data/lib/sprockets/unprocessed_asset.rb +10 -28
- data/lib/turbo-sprockets/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -5,9 +5,6 @@
|
|
5
5
|
* Speeds up your Rails 3 `rake assets:precompile` by only recompiling changed assets, based on a hash of their source files
|
6
6
|
* Only compiles once to generate both fingerprinted and non-fingerprinted assets
|
7
7
|
|
8
|
-
This is a backport of the work I've done for Rails 4.0.0, released as
|
9
|
-
a gem for Rails 3.2.x. (See [sprockets-rails #21](https://github.com/rails/sprockets-rails/pull/21) and [sprockets #367](https://github.com/sstephenson/sprockets/pull/367) for the Rails 4 pull requests.)
|
10
|
-
|
11
8
|
|
12
9
|
### Disclaimer
|
13
10
|
|
@@ -46,7 +43,11 @@ Enjoy your lightning fast deploys!
|
|
46
43
|
### [asset_sync](https://github.com/rumblelabs/asset_sync)
|
47
44
|
|
48
45
|
Fully compatible. Just don't use the experimental `AssetSync.config.manifest = true` configuration option until
|
49
|
-
[my asset_sync patch](https://github.com/rumblelabs/asset_sync/pull/110) has been merged.
|
46
|
+
[my asset_sync patch](https://github.com/rumblelabs/asset_sync/pull/110) has been merged. Alternatively, you can use my patched `asset_sync` with the following line in your `Gemfile`:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
gem "asset_sync", :github => "ndbroadbent/asset_sync", :branch => "new_manifest_support"
|
50
|
+
```
|
50
51
|
|
51
52
|
|
52
53
|
### [wicked_pdf](https://github.com/mileszs/wicked_pdf)
|
@@ -67,6 +68,12 @@ Please let me know if you have any problems with other gems, and I will either f
|
|
67
68
|
|
68
69
|
`turbo-sprockets-rails3` should work out of the box with Capistrano.
|
69
70
|
|
71
|
+
You may also like to take a look at my [Capistrano Pull Request](https://github.com/capistrano/capistrano/pull/281) that attempts to solve the problems of asset rollback and invalidation. You can try out this solution by adding the following to your Gemfile:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
gem "capistrano", :github => "ndbroadbent/capistrano", :branch => "assets_rollback_and_expiry"
|
75
|
+
```
|
76
|
+
|
70
77
|
### Heroku
|
71
78
|
|
72
79
|
You won't be able to do an 'incremental update' on heroku, since your `public/assets`
|
@@ -1,44 +1,26 @@
|
|
1
1
|
module Sprockets
|
2
2
|
class UnprocessedAsset < AssetWithDependencies
|
3
|
-
def replace_imports(template_with_leading_underscore = true)
|
4
|
-
@source.gsub!(/^@import ["']([^"']+)["'];?/) do |match|
|
5
|
-
begin
|
6
|
-
if template_with_leading_underscore
|
7
|
-
template = "_#{$1}"
|
8
|
-
else
|
9
|
-
template = $1
|
10
|
-
end
|
11
|
-
pathname = @environment.resolve(template)
|
12
|
-
asset = UnprocessedAsset.new @environment, template, pathname
|
13
|
-
# Replace imported template with the unprocessed asset contents.
|
14
|
-
asset.to_s
|
15
|
-
rescue Sprockets::FileNotFound
|
16
|
-
match
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
3
|
def initialize(environment, logical_path, pathname)
|
23
4
|
super
|
24
5
|
|
25
6
|
@environment = environment
|
26
7
|
context = environment.context_class.new(environment, logical_path, pathname)
|
27
8
|
attributes = environment.attributes_for(pathname)
|
28
|
-
processors = attributes.processors
|
29
9
|
|
30
10
|
# Remove all engine processors except ERB to return unprocessed source file
|
31
|
-
|
11
|
+
allowed_engines = [Tilt::ERBTemplate]
|
12
|
+
processors = attributes.processors - (attributes.engines - allowed_engines)
|
32
13
|
|
33
14
|
@source = context.evaluate(pathname, :processors => processors)
|
34
15
|
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
16
|
+
# If the source contains any '@import' directives, add Sass and Less processors.
|
17
|
+
# (@import is quite difficult to handle properly without processing.)
|
18
|
+
if @source.include?("@import")
|
19
|
+
# Process Sass and Less files, since @import is too tricky to handle properly.
|
20
|
+
allowed_engines << Sass::Rails::ScssTemplate if defined?(Sass::Rails::ScssTemplate)
|
21
|
+
allowed_engines << Less::Rails::LessTemplate if defined?(Less::Rails::LessTemplate)
|
22
|
+
processors = attributes.processors - (attributes.engines - allowed_engines)
|
23
|
+
@source = context.evaluate(pathname, :processors => processors)
|
42
24
|
end
|
43
25
|
|
44
26
|
build_required_assets(environment, context, :process => false)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-sprockets-rails3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|