stylus_assets 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -63,7 +63,7 @@ module StylusAssets
|
|
63
63
|
<<-JST
|
64
64
|
(function() {
|
65
65
|
#{ self.class.namespace } || (#{ self.class.namespace } = {});
|
66
|
-
#{ self.class.namespace }['#{ name }'] = function(v, e) { return StylusAssets.render('#{ name }', \"#{ data.gsub(/\n/, "\\n") }\", v, e); };
|
66
|
+
#{ self.class.namespace }['#{ name }'] = function(v, e, i) { return StylusAssets.render('#{ name }', \"#{ data.gsub(/\n/, "\\n") }\", v, e, i); };
|
67
67
|
}).call(this);
|
68
68
|
JST
|
69
69
|
end
|
@@ -16,9 +16,10 @@ class window.StylusAssets
|
|
16
16
|
# @param [String] css the stylus css
|
17
17
|
# @param [Object] variables the stylus variables
|
18
18
|
# @param [HTMLDocument] element a target element to add the styles
|
19
|
+
# @param [String] id the optional id of the style
|
19
20
|
# @return [String] the css styles
|
20
21
|
#
|
21
|
-
@render: (name, css, variables = {}, doc = undefined) ->
|
22
|
+
@render: (name, css, variables = {}, doc = undefined, id = undefined) ->
|
22
23
|
result = undefined
|
23
24
|
newVariables = {}
|
24
25
|
hasSet = false
|
@@ -70,7 +71,7 @@ get(hash, key)
|
|
70
71
|
# Add a style tag with the css when a document is given
|
71
72
|
#
|
72
73
|
if doc instanceof HTMLDocument || Object.prototype.toString.call(doc) is '[object HTMLDocument]'
|
73
|
-
id = "stylus-asset-#{ name.replace(/[^A-Za-z0-1_/-]/, '').replace(/[/_]/, '-') }"
|
74
|
+
id = "stylus-asset-#{ name.replace(/[^A-Za-z0-1_/-]/, '').replace(/[/_]/, '-') }#{ if id then "-#{ id }" else '' }"
|
74
75
|
|
75
76
|
style = doc.getElementById(id) || doc.createElement 'style'
|
76
77
|
style.type = 'text/css'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylus_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
segments:
|
90
90
|
- 0
|
91
|
-
hash:
|
91
|
+
hash: 3904086126830443777
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|