cancel
Showing results for 
Search instead for 
Did you mean: 

Include CSS -- not file permissions

Include CSS -- not file permissions

As of 2.02. I see that a lot of posts regarding .css blame the user for not setting file permissions correctly, specifically pointing to an article stating what permissions and where to apply them. For the record, here are mine:

 

<magento 2 root>/pub/static and below: 775 (owner root.www-data)
<magento 2 root>/var/ and below 777


I am following the doc entitled Include CSS. It states "To include a CSS file, add the <css src="<path>/<file>" media="print|<option>"/>" in "<theme_dir>/Magento_Theme/layout/default_head_blocks.xml.

 

In my case:

$ cat <magento 2 root>/app/design/frontend/<company name>/<theme name>/layout/default_head_blocks.xml


<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi= <deleted to get this forum editor to accept>

xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
        <css src="css/custom.css" media="print|<option>"/>
    </head>
</page>

 

with the custom.css file located in <magento 2 root>/app/design/frontend/<company>/<theme name>/web/css/custom.css, having permission of 775.

 

No joy. No reference to custom.css in the page source when viewed in the browser. Note that I also lopped of the media="print|<option>" at the end of the css src=line, to mimic one of the lines in the example at that page, but that didn't work either.

 

Can anyone suggest anything? Or is it best to put it all aside and wait for 2.1?

 

Note: the forum editor forced me to change some of the xml/html quoted. It might be nice to have a plain text option for the forum editor.

 

 

2 REPLIES 2

Re: Include CSS -- not file permissions

Try to use a module prefix (:: syntax) before a CSS file name: https://mage2.pro/t/34

Re: Include CSS -- not file permissions

Thanks for your reply. I think we'll pass on Mage 2.0 for now.