Magento 2 not loading custom css
I am new to Magento 2 Theme Development I have gone through the frontend development guide and set up my child theme of the Magento Blank theme. I have done all that the guide says and added my CSS file but it is not showing on the frontend.
I have cleared all the caches and deployed static content
Below is my setup. Any help would be great!
design/frontend/Speedcrete/speedcrete
Inside the folder speedcrete it is:
|-etc
| |-view.xml
|
|- Magento_theme
| |-layout
| |-default_head_blocks.xml
|
|
|-media
| |-preview.jpg
|
|-web
| |-css
| |-custom.css
| |-fonts
| |-images
| |-js
|
|-registration.php
|-theme.xml
Here is the code for default default_head_blocks.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<!-- Add local resources -->
<css src="Magento_Theme::css/speedcrete.css"/>
</head>
</page>
Here is the code for the theme.xml file:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>speedcrete</title> <!-- your theme's name -->
<parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
Let me know if I need to give any more code for any of the other files.
I have tried to run the following commands and then cleared the cache and so joy.
php bin/Magento setup:upgrade --keep-generated
php bin/Magento setup:static-content:deploy
Please let me know if I am missing anything.
Only another thing it might be is that there are no files under design/frontend/Magento/blank. I looked at another forum and they said it was ok as it is stored elsewhere. It seems to be the case as the "blank" theme is showing when I have my custom theme activated. Only cannot see any custom CSS I add.
magento2
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am new to Magento 2 Theme Development I have gone through the frontend development guide and set up my child theme of the Magento Blank theme. I have done all that the guide says and added my CSS file but it is not showing on the frontend.
I have cleared all the caches and deployed static content
Below is my setup. Any help would be great!
design/frontend/Speedcrete/speedcrete
Inside the folder speedcrete it is:
|-etc
| |-view.xml
|
|- Magento_theme
| |-layout
| |-default_head_blocks.xml
|
|
|-media
| |-preview.jpg
|
|-web
| |-css
| |-custom.css
| |-fonts
| |-images
| |-js
|
|-registration.php
|-theme.xml
Here is the code for default default_head_blocks.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<!-- Add local resources -->
<css src="Magento_Theme::css/speedcrete.css"/>
</head>
</page>
Here is the code for the theme.xml file:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>speedcrete</title> <!-- your theme's name -->
<parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
Let me know if I need to give any more code for any of the other files.
I have tried to run the following commands and then cleared the cache and so joy.
php bin/Magento setup:upgrade --keep-generated
php bin/Magento setup:static-content:deploy
Please let me know if I am missing anything.
Only another thing it might be is that there are no files under design/frontend/Magento/blank. I looked at another forum and they said it was ok as it is stored elsewhere. It seems to be the case as the "blank" theme is showing when I have my custom theme activated. Only cannot see any custom CSS I add.
magento2
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Have you got your solution ?
– Pawan
Aug 9 '17 at 16:29
add a comment |
I am new to Magento 2 Theme Development I have gone through the frontend development guide and set up my child theme of the Magento Blank theme. I have done all that the guide says and added my CSS file but it is not showing on the frontend.
I have cleared all the caches and deployed static content
Below is my setup. Any help would be great!
design/frontend/Speedcrete/speedcrete
Inside the folder speedcrete it is:
|-etc
| |-view.xml
|
|- Magento_theme
| |-layout
| |-default_head_blocks.xml
|
|
|-media
| |-preview.jpg
|
|-web
| |-css
| |-custom.css
| |-fonts
| |-images
| |-js
|
|-registration.php
|-theme.xml
Here is the code for default default_head_blocks.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<!-- Add local resources -->
<css src="Magento_Theme::css/speedcrete.css"/>
</head>
</page>
Here is the code for the theme.xml file:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>speedcrete</title> <!-- your theme's name -->
<parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
Let me know if I need to give any more code for any of the other files.
I have tried to run the following commands and then cleared the cache and so joy.
php bin/Magento setup:upgrade --keep-generated
php bin/Magento setup:static-content:deploy
Please let me know if I am missing anything.
Only another thing it might be is that there are no files under design/frontend/Magento/blank. I looked at another forum and they said it was ok as it is stored elsewhere. It seems to be the case as the "blank" theme is showing when I have my custom theme activated. Only cannot see any custom CSS I add.
magento2
I am new to Magento 2 Theme Development I have gone through the frontend development guide and set up my child theme of the Magento Blank theme. I have done all that the guide says and added my CSS file but it is not showing on the frontend.
I have cleared all the caches and deployed static content
Below is my setup. Any help would be great!
design/frontend/Speedcrete/speedcrete
Inside the folder speedcrete it is:
|-etc
| |-view.xml
|
|- Magento_theme
| |-layout
| |-default_head_blocks.xml
|
|
|-media
| |-preview.jpg
|
|-web
| |-css
| |-custom.css
| |-fonts
| |-images
| |-js
|
|-registration.php
|-theme.xml
Here is the code for default default_head_blocks.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<!-- Add local resources -->
<css src="Magento_Theme::css/speedcrete.css"/>
</head>
</page>
Here is the code for the theme.xml file:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>speedcrete</title> <!-- your theme's name -->
<parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
Let me know if I need to give any more code for any of the other files.
I have tried to run the following commands and then cleared the cache and so joy.
php bin/Magento setup:upgrade --keep-generated
php bin/Magento setup:static-content:deploy
Please let me know if I am missing anything.
Only another thing it might be is that there are no files under design/frontend/Magento/blank. I looked at another forum and they said it was ok as it is stored elsewhere. It seems to be the case as the "blank" theme is showing when I have my custom theme activated. Only cannot see any custom CSS I add.
magento2
magento2
asked Aug 9 '17 at 13:22
Scott LunnonScott Lunnon
239
239
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Have you got your solution ?
– Pawan
Aug 9 '17 at 16:29
add a comment |
Have you got your solution ?
– Pawan
Aug 9 '17 at 16:29
Have you got your solution ?
– Pawan
Aug 9 '17 at 16:29
Have you got your solution ?
– Pawan
Aug 9 '17 at 16:29
add a comment |
2 Answers
2
active
oldest
votes
If you want your custom CSS in web/css
folder directly within theme root then update your default head blocks to remove the Magento_Theme so that it isn't looking in the magento theme directory:
<head>
<!-- Add local resources -->
<css src="css/speedcrete.css"/>
</head>
I can't see your speedcrete.css in your tree depicted in question however this should go where custom.css is located.
Also the Blank theme being empty is fine depending on how you installed Magento, if it was installed with composer the theme will be located in vendor/magento/theme-frontend-blank/
directory. If downloaded from github i believe it should be design/frontend/Magento/blank
however.
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
|
show 4 more comments
In my case, i just add default.xml to my themes. and it's working fine.
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="default_head_blocks"/>
...
and default_head_blocks.xml
<head>
...
<css src="css/custom.css"/>
...
</head>
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f188527%2fmagento-2-not-loading-custom-css%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want your custom CSS in web/css
folder directly within theme root then update your default head blocks to remove the Magento_Theme so that it isn't looking in the magento theme directory:
<head>
<!-- Add local resources -->
<css src="css/speedcrete.css"/>
</head>
I can't see your speedcrete.css in your tree depicted in question however this should go where custom.css is located.
Also the Blank theme being empty is fine depending on how you installed Magento, if it was installed with composer the theme will be located in vendor/magento/theme-frontend-blank/
directory. If downloaded from github i believe it should be design/frontend/Magento/blank
however.
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
|
show 4 more comments
If you want your custom CSS in web/css
folder directly within theme root then update your default head blocks to remove the Magento_Theme so that it isn't looking in the magento theme directory:
<head>
<!-- Add local resources -->
<css src="css/speedcrete.css"/>
</head>
I can't see your speedcrete.css in your tree depicted in question however this should go where custom.css is located.
Also the Blank theme being empty is fine depending on how you installed Magento, if it was installed with composer the theme will be located in vendor/magento/theme-frontend-blank/
directory. If downloaded from github i believe it should be design/frontend/Magento/blank
however.
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
|
show 4 more comments
If you want your custom CSS in web/css
folder directly within theme root then update your default head blocks to remove the Magento_Theme so that it isn't looking in the magento theme directory:
<head>
<!-- Add local resources -->
<css src="css/speedcrete.css"/>
</head>
I can't see your speedcrete.css in your tree depicted in question however this should go where custom.css is located.
Also the Blank theme being empty is fine depending on how you installed Magento, if it was installed with composer the theme will be located in vendor/magento/theme-frontend-blank/
directory. If downloaded from github i believe it should be design/frontend/Magento/blank
however.
If you want your custom CSS in web/css
folder directly within theme root then update your default head blocks to remove the Magento_Theme so that it isn't looking in the magento theme directory:
<head>
<!-- Add local resources -->
<css src="css/speedcrete.css"/>
</head>
I can't see your speedcrete.css in your tree depicted in question however this should go where custom.css is located.
Also the Blank theme being empty is fine depending on how you installed Magento, if it was installed with composer the theme will be located in vendor/magento/theme-frontend-blank/
directory. If downloaded from github i believe it should be design/frontend/Magento/blank
however.
edited Aug 9 '17 at 13:35
answered Aug 9 '17 at 13:29
harriharri
2,8441447
2,8441447
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
|
show 4 more comments
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
It was installed via composer, as the blank theme resides in vendor/magento/theme-frontend-blank.
– Scott Lunnon
Aug 9 '17 at 13:48
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
That hasn't seemed to have worked!
– Scott Lunnon
Aug 9 '17 at 14:08
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
So have you disabled cache / cleared cache? Also check markup and console to see if the file is showing or just not being found.
– harri
Aug 9 '17 at 16:37
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
Sorry yeah I see you mentioned clearing cache already. I would also take the keep generated out of your deploy command
– harri
Aug 9 '17 at 17:24
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
I have re-run the --keep-generated out of my deploy command. The file isn't appearing in the console.
– Scott Lunnon
Aug 10 '17 at 7:38
|
show 4 more comments
In my case, i just add default.xml to my themes. and it's working fine.
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="default_head_blocks"/>
...
and default_head_blocks.xml
<head>
...
<css src="css/custom.css"/>
...
</head>
add a comment |
In my case, i just add default.xml to my themes. and it's working fine.
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="default_head_blocks"/>
...
and default_head_blocks.xml
<head>
...
<css src="css/custom.css"/>
...
</head>
add a comment |
In my case, i just add default.xml to my themes. and it's working fine.
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="default_head_blocks"/>
...
and default_head_blocks.xml
<head>
...
<css src="css/custom.css"/>
...
</head>
In my case, i just add default.xml to my themes. and it's working fine.
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="default_head_blocks"/>
...
and default_head_blocks.xml
<head>
...
<css src="css/custom.css"/>
...
</head>
answered Aug 13 '18 at 4:35
JackroseJackrose
34312
34312
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f188527%2fmagento-2-not-loading-custom-css%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you got your solution ?
– Pawan
Aug 9 '17 at 16:29