rails stylesheet_link_tag 创建一个html中的css标签

Returns a stylesheet link tag for the sources specified as arguments. Ifyou don’t specify an extension, .css will be appendedautomatically. You can modify the link attributes by passing a hash as thelast argument. For historical reasons, the ‘media’ attribute will always bepresent and defaults to “screen”, so you must explicitly set it to “all”for the stylesheet(s) to apply to all media types.

stylesheet_link_tag "style"
# => <link href="/assets/style.css" media="screen" rel="stylesheet" />

stylesheet_link_tag "style.css"
# => <link href="/assets/style.css" media="screen" rel="stylesheet" />

stylesheet_link_tag "http://www.example.com/style.css"
# => <link href="http://www.example.com/style.css" media="screen" rel="stylesheet" />

stylesheet_link_tag "style", media: "all"
# => <link href="/assets/style.css" media="all" rel="stylesheet" />

stylesheet_link_tag "style", media: "print"
# => <link href="/assets/style.css" media="print" rel="stylesheet" />

stylesheet_link_tag "random.styles", "/css/stylish"
# => <link href="/assets/random.styles" media="screen" rel="stylesheet" />
# <link href="/css/stylish.css" media="screen" rel="stylesheet" />

你可能感兴趣的:(rails stylesheet_link_tag 创建一个html中的css标签)