@@ -7,21 +7,45 @@ module ViewHelpers
77 class UnexpectedHashedScriptException < StandardError ; end
88
99 # Public: create a style tag using the content security policy nonce.
10- # Instructs secure_headers to append a nonce to style/script -src directives .
10+ # Instructs secure_headers to append a nonce to style-src directive .
1111 #
1212 # Returns an html-safe style tag with the nonce attribute.
1313 def nonced_style_tag ( content_or_options = { } , &block )
1414 nonced_tag ( :style , content_or_options , block )
1515 end
1616
17+ # Public: create a stylesheet link tag using the content security policy nonce.
18+ # Instructs secure_headers to append a nonce to style-src directive.
19+ #
20+ # Returns an html-safe link tag with the nonce attribute.
21+ def nonced_stylesheet_link_tag ( *args , &block )
22+ stylesheet_link_tag ( *args , nonce : content_security_policy_nonce ( :style ) , &block )
23+ end
24+
1725 # Public: create a script tag using the content security policy nonce.
18- # Instructs secure_headers to append a nonce to style/ script-src directives .
26+ # Instructs secure_headers to append a nonce to script-src directive .
1927 #
2028 # Returns an html-safe script tag with the nonce attribute.
2129 def nonced_javascript_tag ( content_or_options = { } , &block )
2230 nonced_tag ( :script , content_or_options , block )
2331 end
2432
33+ # Public: create a script src tag using the content security policy nonce.
34+ # Instructs secure_headers to append a nonce to script-src directive.
35+ #
36+ # Returns an html-safe script tag with the nonce attribute.
37+ def nonced_javascript_include_tag ( *args , &block )
38+ javascript_include_tag ( *args , nonce : content_security_policy_nonce ( :script ) , &block )
39+ end
40+
41+ # Public: create a script Webpacker pack tag using the content security policy nonce.
42+ # Instructs secure_headers to append a nonce to script-src directive.
43+ #
44+ # Returns an html-safe script tag with the nonce attribute.
45+ def nonced_javascript_pack_tag ( *args , &block )
46+ javascript_pack_tag ( *args , nonce : content_security_policy_nonce ( :script ) , &block )
47+ end
48+
2549 # Public: use the content security policy nonce for this request directly.
2650 # Instructs secure_headers to append a nonce to style/script-src directives.
2751 #
0 commit comments