silian-rail 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/silian-rail/asset_helpers.rb +1 -1
- data/lib/silian-rail/railtie.rb +0 -5
- data/lib/silian-rail/version.rb +1 -1
- metadata +1 -16
- data/lib/silian-rail/post_processor.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71a41365b1ab41d40657274527d108ce970a6ffe
|
4
|
+
data.tar.gz: 3f633bde81a202edc8fdbe0685c6cc773f3a1bb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3ee34b914bacd528c9091bce2d01dfd47418db561db5676a6af0529a4c27eeff8e6c7f44083d3bacce7385333614b79e6714946ac78ffe1d8c7f9a8e489168b
|
7
|
+
data.tar.gz: af4a6e0d35dd564ef86851153f3c1f6982af2c0fdefec33b3b5b4c6872a819ab5465c7dcde825c29ab358e2e2c852c55311cb99c8c362820da2ba899d0a2c697
|
data/lib/silian-rail/railtie.rb
CHANGED
@@ -7,11 +7,6 @@ module SilianRail
|
|
7
7
|
comments: [['<!--', '-->']]
|
8
8
|
)
|
9
9
|
|
10
|
-
require 'silian-rail/post_processor'
|
11
|
-
env.register_postprocessor 'text/html', :web_components do |context, data|
|
12
|
-
SilianRail::PostProcessor.new(context).call(data)
|
13
|
-
end
|
14
|
-
|
15
10
|
require 'sprockets/bundle'
|
16
11
|
env.register_bundle_processor 'text/html', Sprockets::Bundle
|
17
12
|
|
data/lib/silian-rail/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silian-rail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Robins
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: loofah
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.0'
|
41
27
|
description:
|
42
28
|
email: brandon.robins@onebnottwo.com
|
43
29
|
executables: []
|
@@ -50,7 +36,6 @@ files:
|
|
50
36
|
- lib/generators/silian_rail/templates/component_manifest.html
|
51
37
|
- lib/silian-rail.rb
|
52
38
|
- lib/silian-rail/asset_helpers.rb
|
53
|
-
- lib/silian-rail/post_processor.rb
|
54
39
|
- lib/silian-rail/railtie.rb
|
55
40
|
- lib/silian-rail/version.rb
|
56
41
|
homepage: http://www.github.com/eanlain/silian-rail
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module SilianRail
|
2
|
-
class PostProcessor
|
3
|
-
COMMENT_PATTERN = Regexp.new("<!---->|<!--[^\\[].*?-->", Regexp::MULTILINE | Regexp::IGNORECASE)
|
4
|
-
|
5
|
-
def initialize(context)
|
6
|
-
@context = context
|
7
|
-
@current_directory = File.dirname(context.pathname)
|
8
|
-
@import_assets = []
|
9
|
-
|
10
|
-
@remove_link_imports = Loofah::Scrubber.new do |node|
|
11
|
-
if (node.name == 'link') && (node['rel'] == 'import')
|
12
|
-
@import_assets.push get_asset_abs_path(node['href'])
|
13
|
-
|
14
|
-
node.remove
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def call(data)
|
20
|
-
data = scrub_link_imports(data)
|
21
|
-
require_import_assets
|
22
|
-
|
23
|
-
data.to_s.gsub(COMMENT_PATTERN, '')
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def get_asset_abs_path(relative_path)
|
29
|
-
File.absolute_path(relative_path, @current_directory)
|
30
|
-
end
|
31
|
-
|
32
|
-
def require_import_assets
|
33
|
-
@import_assets.each { |asset| @context.require_asset(asset) }
|
34
|
-
end
|
35
|
-
|
36
|
-
def scrub_link_imports(data)
|
37
|
-
Loofah.scrub_fragment(data, @remove_link_imports)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|