Magento2: Re generate css file in pub/static folder
I have installed Magento 2 and set developer mode, then I have installed one module that contains css and js files. The module works fine and css and js files are rendering from pub/static folder. Now I have made css changes in module directory css file and run command
php bin/magento setup:static-content:deploy
but Magento is not making my new changes in pub/static css files so I'm getting old css file contents.
Does anyone know how to regenerate the whole css file in pub/static folder?
magento2 css deploy static-content-deploy
add a comment |
I have installed Magento 2 and set developer mode, then I have installed one module that contains css and js files. The module works fine and css and js files are rendering from pub/static folder. Now I have made css changes in module directory css file and run command
php bin/magento setup:static-content:deploy
but Magento is not making my new changes in pub/static css files so I'm getting old css file contents.
Does anyone know how to regenerate the whole css file in pub/static folder?
magento2 css deploy static-content-deploy
7
FYI: Magento 2 has a developer mode so you don't have to deploy static content all the time. I've wasted hours and hours in the past month redeploying static content. So don't be like me, and switch to developer mode (on your local machine. Your live server should be on production mode)
– Nathan Merrill
Dec 22 '16 at 14:40
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
3
If magento is in developer mode it will create symlinks to the static files but for this to happen you have to have.htaccessfile in thepub/staticfolder so it knows how to symlink files, if you deleted the pub/static folder that.htaccessis missing now
– Vlad Patru
Mar 30 '17 at 7:16
@NathanMerrill you are so right but most of the dev's don't read documentation and all the answers and still run the static-content:deploy command and what is a bit sad is that some of the companies with account on Stackexchange provide answers like that, waste of time
– Vlad Patru
Apr 19 '17 at 15:53
add a comment |
I have installed Magento 2 and set developer mode, then I have installed one module that contains css and js files. The module works fine and css and js files are rendering from pub/static folder. Now I have made css changes in module directory css file and run command
php bin/magento setup:static-content:deploy
but Magento is not making my new changes in pub/static css files so I'm getting old css file contents.
Does anyone know how to regenerate the whole css file in pub/static folder?
magento2 css deploy static-content-deploy
I have installed Magento 2 and set developer mode, then I have installed one module that contains css and js files. The module works fine and css and js files are rendering from pub/static folder. Now I have made css changes in module directory css file and run command
php bin/magento setup:static-content:deploy
but Magento is not making my new changes in pub/static css files so I'm getting old css file contents.
Does anyone know how to regenerate the whole css file in pub/static folder?
magento2 css deploy static-content-deploy
magento2 css deploy static-content-deploy
edited Oct 16 '17 at 15:34
Rafael Corrêa Gomes
4,37723063
4,37723063
asked Dec 21 '15 at 7:32
chirag dodiachirag dodia
72231021
72231021
7
FYI: Magento 2 has a developer mode so you don't have to deploy static content all the time. I've wasted hours and hours in the past month redeploying static content. So don't be like me, and switch to developer mode (on your local machine. Your live server should be on production mode)
– Nathan Merrill
Dec 22 '16 at 14:40
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
3
If magento is in developer mode it will create symlinks to the static files but for this to happen you have to have.htaccessfile in thepub/staticfolder so it knows how to symlink files, if you deleted the pub/static folder that.htaccessis missing now
– Vlad Patru
Mar 30 '17 at 7:16
@NathanMerrill you are so right but most of the dev's don't read documentation and all the answers and still run the static-content:deploy command and what is a bit sad is that some of the companies with account on Stackexchange provide answers like that, waste of time
– Vlad Patru
Apr 19 '17 at 15:53
add a comment |
7
FYI: Magento 2 has a developer mode so you don't have to deploy static content all the time. I've wasted hours and hours in the past month redeploying static content. So don't be like me, and switch to developer mode (on your local machine. Your live server should be on production mode)
– Nathan Merrill
Dec 22 '16 at 14:40
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
3
If magento is in developer mode it will create symlinks to the static files but for this to happen you have to have.htaccessfile in thepub/staticfolder so it knows how to symlink files, if you deleted the pub/static folder that.htaccessis missing now
– Vlad Patru
Mar 30 '17 at 7:16
@NathanMerrill you are so right but most of the dev's don't read documentation and all the answers and still run the static-content:deploy command and what is a bit sad is that some of the companies with account on Stackexchange provide answers like that, waste of time
– Vlad Patru
Apr 19 '17 at 15:53
7
7
FYI: Magento 2 has a developer mode so you don't have to deploy static content all the time. I've wasted hours and hours in the past month redeploying static content. So don't be like me, and switch to developer mode (on your local machine. Your live server should be on production mode)
– Nathan Merrill
Dec 22 '16 at 14:40
FYI: Magento 2 has a developer mode so you don't have to deploy static content all the time. I've wasted hours and hours in the past month redeploying static content. So don't be like me, and switch to developer mode (on your local machine. Your live server should be on production mode)
– Nathan Merrill
Dec 22 '16 at 14:40
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
3
3
If magento is in developer mode it will create symlinks to the static files but for this to happen you have to have
.htaccess file in the pub/static folder so it knows how to symlink files, if you deleted the pub/static folder that .htaccess is missing now– Vlad Patru
Mar 30 '17 at 7:16
If magento is in developer mode it will create symlinks to the static files but for this to happen you have to have
.htaccess file in the pub/static folder so it knows how to symlink files, if you deleted the pub/static folder that .htaccess is missing now– Vlad Patru
Mar 30 '17 at 7:16
@NathanMerrill you are so right but most of the dev's don't read documentation and all the answers and still run the static-content:deploy command and what is a bit sad is that some of the companies with account on Stackexchange provide answers like that, waste of time
– Vlad Patru
Apr 19 '17 at 15:53
@NathanMerrill you are so right but most of the dev's don't read documentation and all the answers and still run the static-content:deploy command and what is a bit sad is that some of the companies with account on Stackexchange provide answers like that, waste of time
– Vlad Patru
Apr 19 '17 at 15:53
add a comment |
14 Answers
14
active
oldest
votes
- Remove
pub/static[Keep the .htaccess backed up and copy it again] - Remove
var/cache
- Remove
var/composer_home
- Remove
var/generation
- Remove
var/page_cache
- Remove
var/view_preprocessed
- run
php bin/magento setup:static-content:deploy
38
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
2
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
7
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
9
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
4
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
|
show 5 more comments
answers here don't mention that you shouldn't delete the .htaccess in the pub/static folder.
to delete all files except the .htacces enter the pub/static directory and run
find . -depth -name .htaccess -prune -o -delete
then you can run
rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
1
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
add a comment |
I have just delete the css files from pub/static folder and run the command:
php bin/magento setup:static-content:deploy
It will re generate the same file with latest changes.
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
add a comment |
As the question is for js and css update in Magento 2 in developer mode.
Updating the JS in your respected module,before refreshing page the same file frompub/static/frontend/namespace/theme/ ... module/js/...delete it so after page refresh fresh JS file will generate in pub folder.
Updating the CSS in your respected module, do the pt 1.
Updating Less file
Setup theme in magento ...devtoolsgruntconfigsthemes.js
Clone any one theme example luma theme to your theme and assign a name suppose xyz
xyz: {
area: 'frontend',
name: 'Magento/luma',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
}
In root folder change file name : Gruntfile.js.sample to Gruntfile.js
In root folder change file name : package.json.sample to package.json
Need to have grunt in you site folder else install via npm
Open command prompt with administrator permission
Go to site folder in CMD & hit command grunt exec:theme for first time after deploy the theme
Then grunt less:theme every time if we do any changes in less
If you are doing frequently changes in less use grunt watch so it will automatic hit grunt less:theme
Note : You might get Symlink error so go to file
.../app/etc/di.xmland comment out or remove code (below code ) in
you local till development done, don't push chnaged code of this file
to server, it only required in local if need.
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategySymlink</item>
add a comment |
Ok so based on what I have read in various other posts and my personal experience here is the process to regenerate the CSS or any Static Content:
php bin/magento setup:upgrade
This will wipe out all the necessary cache/generation/etc files without deleting anything you actually need.
php bin/magento setup:di:compile
This will then re-compile the files. Lastly:
php bin/magento setup:static-content:deploy
After the last command everything should be new and fresh, just refresh your page.
----- Notes ------
1) Make sure your file permissions and owner:user group is set correctly before doing this, you may need to speak about these with your sysadmin.
2) If your setup:upgrade command fails it might delete the files and be unable to write the new ones, as was my case due to file permissions. This can break your site, just iron out the permissions, then re-run the command.
3) I have not found (so far) a way to only re-compile a specific theme or file (would be super helpful if anyone finds a way) without writing a completely custom script
If anyone knows of something better let me know, because 12 minutes of compiling files because I had to make some css changes is extremely poor design in my eyes.
--- Edit ---
Magento 2 has Grunt tied into it and this makes refreshing CSS/LESS files infinitely easier if you take the time to configure it. Most the files are there as .sample files just remove the .sample file extension, configure the themes.js file in /dev/tools/grunt/configs folder. Then when you need to refresh your LESS files you simply run grunt less:--theme-- from the command line.
Resource:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
add a comment |
Run these commands on your Magento root folder:
alias mage="php -d memory_limit=-1 -f bin/magento"
chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:static-content:deploy ;
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
add a comment |
Simple way 1
In the Magento Admin. Go to System > Tools > Cache Management and click Flush Static Files Cache.
Simple way 2
If you just changed the css file which already existing, what you need to do is just delete the corresponding file in pub/static, then when you refresh the page, it will generate the new version css file. It works in the developer mode.
Notice
When you create new file, rather than modifying an existing file, you may also need to clear the cache,
php bin/magento cache:flush.Default mode and developer mode doesn't need deploy static view files, because of static files being dynamically generated rather than materialized. (Reference: About Magento modes)
In production mode, you may also need
php bin/magento setup:static-content:deployandphp bin/magento cache:flush, I don't try production mode yet.
add a comment |
Remove folder that contain your theme in pub/static/frontend
clear cache
You can use grunt to watch apply stylesheets. Read here
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
add a comment |
- Remove pub static.
- Give
pub/static777 permission - Clear cache.
- Run:
php bin/magento setup:static-content:deploy
You will see new css.
NOTE:
Give proper folder and file permission.
I hope this will help you.
add a comment |
do not forget to run the grunt exec:theme, grunt less:theme commands where theme is the theme you declared in the themes.js file from the config folder of grunt ( all this is in the developer guide ) and when you have magento in developer mode you shouldn't run the static deploy command, Magento2 works with Symlinks
1
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
add a comment |
There is one important note to make about this question that most of the answers don't specifically point out. In your case (with the set up you are using) the reason your CSS changes aren't getting picked up when you regenerate the CSS into the pub/static folder is you aren't removing the content of the var/view_preprocessed director. Inside this directory there are cached version of your CSS that are pulling into the pub/static folder when you run the php bin/magento setup:static-content:deploy command.
So when you recompile, Magento will first look to the var/view_preprocessed folder for the cached CSS. If this folder is empty, it will look to the theme files and pull that CSS for compilation.
These setting are configurable, so there are a lot of way to get to your destination that will change the path you need to take. But for the solution to your specific setup:
Remove the files from the
pub/staticfolder:rm -rf pub/static/*Remove the files from the
var/view_preprocessedfolder:rm -rf var/view_preprocessed/*Recompile the pub static folder:
php bin/magento setup:static-content:deployClear cache is it's turned on:
php bin/magento cache:cleanRefresh the browser.
1
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…
– circlesix
Jan 25 '18 at 14:04
add a comment |
Couldn't you just flush static cache in the admin panel and then
run php bin/magento setup:static-content:deploy
add a comment |
However, you may add the -f or --force flag to the setup command.
Example:
php bin/magento setup:static-content:deploy -f
add a comment |
I'm gonna drop my wisdom droplet here.
I use a cache_fly.sh bash script which basically does:
#!/bin/bash
start=`date +%s%N`
./magento setup:upgrade &&
./magento cache:flush &&
./magento setup:static-content:deploy -f
end=`date +%s%N`
runtime=$(bc <<< "scale=9;($end-$start)/1000000000")
echo "" && echo "" && echo -e "e[34mTOTAL EXECUTION TIME: e[1me[93m$runtimee[0m"
NOTE: I've added an echo to show me how many time of my life I've wasted waiting for it to run.
Also ./magento is a script to do php bin/magento or call the same thing inside the docker container, if is docker used you could make yours or point to php bin/magento but if you're reading this you should know what I'm talking about, if not, please run asking for help.
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f94502%2fmagento2-re-generate-css-file-in-pub-static-folder%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
14 Answers
14
active
oldest
votes
14 Answers
14
active
oldest
votes
active
oldest
votes
active
oldest
votes
- Remove
pub/static[Keep the .htaccess backed up and copy it again] - Remove
var/cache
- Remove
var/composer_home
- Remove
var/generation
- Remove
var/page_cache
- Remove
var/view_preprocessed
- run
php bin/magento setup:static-content:deploy
38
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
2
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
7
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
9
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
4
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
|
show 5 more comments
- Remove
pub/static[Keep the .htaccess backed up and copy it again] - Remove
var/cache
- Remove
var/composer_home
- Remove
var/generation
- Remove
var/page_cache
- Remove
var/view_preprocessed
- run
php bin/magento setup:static-content:deploy
38
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
2
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
7
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
9
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
4
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
|
show 5 more comments
- Remove
pub/static[Keep the .htaccess backed up and copy it again] - Remove
var/cache
- Remove
var/composer_home
- Remove
var/generation
- Remove
var/page_cache
- Remove
var/view_preprocessed
- run
php bin/magento setup:static-content:deploy
- Remove
pub/static[Keep the .htaccess backed up and copy it again] - Remove
var/cache
- Remove
var/composer_home
- Remove
var/generation
- Remove
var/page_cache
- Remove
var/view_preprocessed
- run
php bin/magento setup:static-content:deploy
edited Oct 15 '17 at 19:08
Tech Dog
216
216
answered Dec 21 '15 at 8:26
Magev2Magev2
2,109810
2,109810
38
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
2
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
7
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
9
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
4
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
|
show 5 more comments
38
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
2
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
7
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
9
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
4
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
38
38
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
M2 doesn't make things very developer friendly.
– Matthew McLennan
Feb 19 '16 at 18:43
2
2
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
is there any other solution without removing the folders manually?
– Claudiu Creanga
Apr 11 '16 at 13:46
7
7
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
@CarComp no files should ever have to be deleted manually. magento should take care of that. it is very annoying
– Claudiu Creanga
Jun 3 '16 at 10:35
9
9
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
U must be new to magento ;)
– CarComp
Jun 3 '16 at 11:46
4
4
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
I think removing pub/static you lose also the .htaccess file inside that is important to avoid 404 errors, is ok to delete the subfolders of pub/static but that .htaccess should be preserved
– Elio Ermini
Sep 8 '16 at 9:42
|
show 5 more comments
answers here don't mention that you shouldn't delete the .htaccess in the pub/static folder.
to delete all files except the .htacces enter the pub/static directory and run
find . -depth -name .htaccess -prune -o -delete
then you can run
rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
1
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
add a comment |
answers here don't mention that you shouldn't delete the .htaccess in the pub/static folder.
to delete all files except the .htacces enter the pub/static directory and run
find . -depth -name .htaccess -prune -o -delete
then you can run
rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
1
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
add a comment |
answers here don't mention that you shouldn't delete the .htaccess in the pub/static folder.
to delete all files except the .htacces enter the pub/static directory and run
find . -depth -name .htaccess -prune -o -delete
then you can run
rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
answers here don't mention that you shouldn't delete the .htaccess in the pub/static folder.
to delete all files except the .htacces enter the pub/static directory and run
find . -depth -name .htaccess -prune -o -delete
then you can run
rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
answered Apr 3 '16 at 0:08
Claudiu CreangaClaudiu Creanga
4,27512875
4,27512875
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
1
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
add a comment |
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
1
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
1
1
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
did not work as expectedd
– Christophe Ferreboeuf
May 9 '17 at 11:28
add a comment |
I have just delete the css files from pub/static folder and run the command:
php bin/magento setup:static-content:deploy
It will re generate the same file with latest changes.
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
add a comment |
I have just delete the css files from pub/static folder and run the command:
php bin/magento setup:static-content:deploy
It will re generate the same file with latest changes.
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
add a comment |
I have just delete the css files from pub/static folder and run the command:
php bin/magento setup:static-content:deploy
It will re generate the same file with latest changes.
I have just delete the css files from pub/static folder and run the command:
php bin/magento setup:static-content:deploy
It will re generate the same file with latest changes.
edited May 4 '16 at 9:41
Siarhey Uchukhlebau
9,63692858
9,63692858
answered Dec 21 '15 at 9:38
chirag dodiachirag dodia
72231021
72231021
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
add a comment |
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:14
add a comment |
As the question is for js and css update in Magento 2 in developer mode.
Updating the JS in your respected module,before refreshing page the same file frompub/static/frontend/namespace/theme/ ... module/js/...delete it so after page refresh fresh JS file will generate in pub folder.
Updating the CSS in your respected module, do the pt 1.
Updating Less file
Setup theme in magento ...devtoolsgruntconfigsthemes.js
Clone any one theme example luma theme to your theme and assign a name suppose xyz
xyz: {
area: 'frontend',
name: 'Magento/luma',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
}
In root folder change file name : Gruntfile.js.sample to Gruntfile.js
In root folder change file name : package.json.sample to package.json
Need to have grunt in you site folder else install via npm
Open command prompt with administrator permission
Go to site folder in CMD & hit command grunt exec:theme for first time after deploy the theme
Then grunt less:theme every time if we do any changes in less
If you are doing frequently changes in less use grunt watch so it will automatic hit grunt less:theme
Note : You might get Symlink error so go to file
.../app/etc/di.xmland comment out or remove code (below code ) in
you local till development done, don't push chnaged code of this file
to server, it only required in local if need.
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategySymlink</item>
add a comment |
As the question is for js and css update in Magento 2 in developer mode.
Updating the JS in your respected module,before refreshing page the same file frompub/static/frontend/namespace/theme/ ... module/js/...delete it so after page refresh fresh JS file will generate in pub folder.
Updating the CSS in your respected module, do the pt 1.
Updating Less file
Setup theme in magento ...devtoolsgruntconfigsthemes.js
Clone any one theme example luma theme to your theme and assign a name suppose xyz
xyz: {
area: 'frontend',
name: 'Magento/luma',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
}
In root folder change file name : Gruntfile.js.sample to Gruntfile.js
In root folder change file name : package.json.sample to package.json
Need to have grunt in you site folder else install via npm
Open command prompt with administrator permission
Go to site folder in CMD & hit command grunt exec:theme for first time after deploy the theme
Then grunt less:theme every time if we do any changes in less
If you are doing frequently changes in less use grunt watch so it will automatic hit grunt less:theme
Note : You might get Symlink error so go to file
.../app/etc/di.xmland comment out or remove code (below code ) in
you local till development done, don't push chnaged code of this file
to server, it only required in local if need.
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategySymlink</item>
add a comment |
As the question is for js and css update in Magento 2 in developer mode.
Updating the JS in your respected module,before refreshing page the same file frompub/static/frontend/namespace/theme/ ... module/js/...delete it so after page refresh fresh JS file will generate in pub folder.
Updating the CSS in your respected module, do the pt 1.
Updating Less file
Setup theme in magento ...devtoolsgruntconfigsthemes.js
Clone any one theme example luma theme to your theme and assign a name suppose xyz
xyz: {
area: 'frontend',
name: 'Magento/luma',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
}
In root folder change file name : Gruntfile.js.sample to Gruntfile.js
In root folder change file name : package.json.sample to package.json
Need to have grunt in you site folder else install via npm
Open command prompt with administrator permission
Go to site folder in CMD & hit command grunt exec:theme for first time after deploy the theme
Then grunt less:theme every time if we do any changes in less
If you are doing frequently changes in less use grunt watch so it will automatic hit grunt less:theme
Note : You might get Symlink error so go to file
.../app/etc/di.xmland comment out or remove code (below code ) in
you local till development done, don't push chnaged code of this file
to server, it only required in local if need.
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategySymlink</item>
As the question is for js and css update in Magento 2 in developer mode.
Updating the JS in your respected module,before refreshing page the same file frompub/static/frontend/namespace/theme/ ... module/js/...delete it so after page refresh fresh JS file will generate in pub folder.
Updating the CSS in your respected module, do the pt 1.
Updating Less file
Setup theme in magento ...devtoolsgruntconfigsthemes.js
Clone any one theme example luma theme to your theme and assign a name suppose xyz
xyz: {
area: 'frontend',
name: 'Magento/luma',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
}
In root folder change file name : Gruntfile.js.sample to Gruntfile.js
In root folder change file name : package.json.sample to package.json
Need to have grunt in you site folder else install via npm
Open command prompt with administrator permission
Go to site folder in CMD & hit command grunt exec:theme for first time after deploy the theme
Then grunt less:theme every time if we do any changes in less
If you are doing frequently changes in less use grunt watch so it will automatic hit grunt less:theme
Note : You might get Symlink error so go to file
.../app/etc/di.xmland comment out or remove code (below code ) in
you local till development done, don't push chnaged code of this file
to server, it only required in local if need.
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategySymlink</item>
edited May 1 '18 at 4:54
ABHISHEK TRIPATHI
1,6881626
1,6881626
answered Sep 21 '17 at 10:42
Kanhaiya lalKanhaiya lal
870317
870317
add a comment |
add a comment |
Ok so based on what I have read in various other posts and my personal experience here is the process to regenerate the CSS or any Static Content:
php bin/magento setup:upgrade
This will wipe out all the necessary cache/generation/etc files without deleting anything you actually need.
php bin/magento setup:di:compile
This will then re-compile the files. Lastly:
php bin/magento setup:static-content:deploy
After the last command everything should be new and fresh, just refresh your page.
----- Notes ------
1) Make sure your file permissions and owner:user group is set correctly before doing this, you may need to speak about these with your sysadmin.
2) If your setup:upgrade command fails it might delete the files and be unable to write the new ones, as was my case due to file permissions. This can break your site, just iron out the permissions, then re-run the command.
3) I have not found (so far) a way to only re-compile a specific theme or file (would be super helpful if anyone finds a way) without writing a completely custom script
If anyone knows of something better let me know, because 12 minutes of compiling files because I had to make some css changes is extremely poor design in my eyes.
--- Edit ---
Magento 2 has Grunt tied into it and this makes refreshing CSS/LESS files infinitely easier if you take the time to configure it. Most the files are there as .sample files just remove the .sample file extension, configure the themes.js file in /dev/tools/grunt/configs folder. Then when you need to refresh your LESS files you simply run grunt less:--theme-- from the command line.
Resource:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
add a comment |
Ok so based on what I have read in various other posts and my personal experience here is the process to regenerate the CSS or any Static Content:
php bin/magento setup:upgrade
This will wipe out all the necessary cache/generation/etc files without deleting anything you actually need.
php bin/magento setup:di:compile
This will then re-compile the files. Lastly:
php bin/magento setup:static-content:deploy
After the last command everything should be new and fresh, just refresh your page.
----- Notes ------
1) Make sure your file permissions and owner:user group is set correctly before doing this, you may need to speak about these with your sysadmin.
2) If your setup:upgrade command fails it might delete the files and be unable to write the new ones, as was my case due to file permissions. This can break your site, just iron out the permissions, then re-run the command.
3) I have not found (so far) a way to only re-compile a specific theme or file (would be super helpful if anyone finds a way) without writing a completely custom script
If anyone knows of something better let me know, because 12 minutes of compiling files because I had to make some css changes is extremely poor design in my eyes.
--- Edit ---
Magento 2 has Grunt tied into it and this makes refreshing CSS/LESS files infinitely easier if you take the time to configure it. Most the files are there as .sample files just remove the .sample file extension, configure the themes.js file in /dev/tools/grunt/configs folder. Then when you need to refresh your LESS files you simply run grunt less:--theme-- from the command line.
Resource:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
add a comment |
Ok so based on what I have read in various other posts and my personal experience here is the process to regenerate the CSS or any Static Content:
php bin/magento setup:upgrade
This will wipe out all the necessary cache/generation/etc files without deleting anything you actually need.
php bin/magento setup:di:compile
This will then re-compile the files. Lastly:
php bin/magento setup:static-content:deploy
After the last command everything should be new and fresh, just refresh your page.
----- Notes ------
1) Make sure your file permissions and owner:user group is set correctly before doing this, you may need to speak about these with your sysadmin.
2) If your setup:upgrade command fails it might delete the files and be unable to write the new ones, as was my case due to file permissions. This can break your site, just iron out the permissions, then re-run the command.
3) I have not found (so far) a way to only re-compile a specific theme or file (would be super helpful if anyone finds a way) without writing a completely custom script
If anyone knows of something better let me know, because 12 minutes of compiling files because I had to make some css changes is extremely poor design in my eyes.
--- Edit ---
Magento 2 has Grunt tied into it and this makes refreshing CSS/LESS files infinitely easier if you take the time to configure it. Most the files are there as .sample files just remove the .sample file extension, configure the themes.js file in /dev/tools/grunt/configs folder. Then when you need to refresh your LESS files you simply run grunt less:--theme-- from the command line.
Resource:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html
Ok so based on what I have read in various other posts and my personal experience here is the process to regenerate the CSS or any Static Content:
php bin/magento setup:upgrade
This will wipe out all the necessary cache/generation/etc files without deleting anything you actually need.
php bin/magento setup:di:compile
This will then re-compile the files. Lastly:
php bin/magento setup:static-content:deploy
After the last command everything should be new and fresh, just refresh your page.
----- Notes ------
1) Make sure your file permissions and owner:user group is set correctly before doing this, you may need to speak about these with your sysadmin.
2) If your setup:upgrade command fails it might delete the files and be unable to write the new ones, as was my case due to file permissions. This can break your site, just iron out the permissions, then re-run the command.
3) I have not found (so far) a way to only re-compile a specific theme or file (would be super helpful if anyone finds a way) without writing a completely custom script
If anyone knows of something better let me know, because 12 minutes of compiling files because I had to make some css changes is extremely poor design in my eyes.
--- Edit ---
Magento 2 has Grunt tied into it and this makes refreshing CSS/LESS files infinitely easier if you take the time to configure it. Most the files are there as .sample files just remove the .sample file extension, configure the themes.js file in /dev/tools/grunt/configs folder. Then when you need to refresh your LESS files you simply run grunt less:--theme-- from the command line.
Resource:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html
edited Apr 19 '17 at 15:23
answered Mar 14 '17 at 22:35
VallierVallier
22126
22126
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
add a comment |
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Stop providing the php bin/magento setup:static-content:deploy method, in developer mode magento has symlinks
– Vlad Patru
Apr 19 '17 at 15:54
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
Oh and manually deleting the folders, removing the .htaccess files and others unrelated, and forcing it to rebuild is the better method??? I added a comment about using Grunt, because simply moving your store to developer mode doesn't instantiate all the symlinks and refresh your css on page reload.
– Vallier
Apr 19 '17 at 23:14
add a comment |
Run these commands on your Magento root folder:
alias mage="php -d memory_limit=-1 -f bin/magento"
chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:static-content:deploy ;
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
add a comment |
Run these commands on your Magento root folder:
alias mage="php -d memory_limit=-1 -f bin/magento"
chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:static-content:deploy ;
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
add a comment |
Run these commands on your Magento root folder:
alias mage="php -d memory_limit=-1 -f bin/magento"
chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:static-content:deploy ;
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/
Run these commands on your Magento root folder:
alias mage="php -d memory_limit=-1 -f bin/magento"
chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:static-content:deploy ;
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/
answered Apr 19 '17 at 16:35
Rafael Corrêa GomesRafael Corrêa Gomes
4,37723063
4,37723063
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
add a comment |
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
Never thought of running a reindex in background 👍🏻
– Sergei Filippov
Jul 12 '17 at 11:56
add a comment |
Simple way 1
In the Magento Admin. Go to System > Tools > Cache Management and click Flush Static Files Cache.
Simple way 2
If you just changed the css file which already existing, what you need to do is just delete the corresponding file in pub/static, then when you refresh the page, it will generate the new version css file. It works in the developer mode.
Notice
When you create new file, rather than modifying an existing file, you may also need to clear the cache,
php bin/magento cache:flush.Default mode and developer mode doesn't need deploy static view files, because of static files being dynamically generated rather than materialized. (Reference: About Magento modes)
In production mode, you may also need
php bin/magento setup:static-content:deployandphp bin/magento cache:flush, I don't try production mode yet.
add a comment |
Simple way 1
In the Magento Admin. Go to System > Tools > Cache Management and click Flush Static Files Cache.
Simple way 2
If you just changed the css file which already existing, what you need to do is just delete the corresponding file in pub/static, then when you refresh the page, it will generate the new version css file. It works in the developer mode.
Notice
When you create new file, rather than modifying an existing file, you may also need to clear the cache,
php bin/magento cache:flush.Default mode and developer mode doesn't need deploy static view files, because of static files being dynamically generated rather than materialized. (Reference: About Magento modes)
In production mode, you may also need
php bin/magento setup:static-content:deployandphp bin/magento cache:flush, I don't try production mode yet.
add a comment |
Simple way 1
In the Magento Admin. Go to System > Tools > Cache Management and click Flush Static Files Cache.
Simple way 2
If you just changed the css file which already existing, what you need to do is just delete the corresponding file in pub/static, then when you refresh the page, it will generate the new version css file. It works in the developer mode.
Notice
When you create new file, rather than modifying an existing file, you may also need to clear the cache,
php bin/magento cache:flush.Default mode and developer mode doesn't need deploy static view files, because of static files being dynamically generated rather than materialized. (Reference: About Magento modes)
In production mode, you may also need
php bin/magento setup:static-content:deployandphp bin/magento cache:flush, I don't try production mode yet.
Simple way 1
In the Magento Admin. Go to System > Tools > Cache Management and click Flush Static Files Cache.
Simple way 2
If you just changed the css file which already existing, what you need to do is just delete the corresponding file in pub/static, then when you refresh the page, it will generate the new version css file. It works in the developer mode.
Notice
When you create new file, rather than modifying an existing file, you may also need to clear the cache,
php bin/magento cache:flush.Default mode and developer mode doesn't need deploy static view files, because of static files being dynamically generated rather than materialized. (Reference: About Magento modes)
In production mode, you may also need
php bin/magento setup:static-content:deployandphp bin/magento cache:flush, I don't try production mode yet.
answered Aug 17 '17 at 10:12
Key ShangKey Shang
1,6111135
1,6111135
add a comment |
add a comment |
Remove folder that contain your theme in pub/static/frontend
clear cache
You can use grunt to watch apply stylesheets. Read here
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
add a comment |
Remove folder that contain your theme in pub/static/frontend
clear cache
You can use grunt to watch apply stylesheets. Read here
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
add a comment |
Remove folder that contain your theme in pub/static/frontend
clear cache
You can use grunt to watch apply stylesheets. Read here
Remove folder that contain your theme in pub/static/frontend
clear cache
You can use grunt to watch apply stylesheets. Read here
answered Dec 21 '15 at 8:00
mrtuvnmrtuvn
1,7851729
1,7851729
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
add a comment |
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
add a comment |
- Remove pub static.
- Give
pub/static777 permission - Clear cache.
- Run:
php bin/magento setup:static-content:deploy
You will see new css.
NOTE:
Give proper folder and file permission.
I hope this will help you.
add a comment |
- Remove pub static.
- Give
pub/static777 permission - Clear cache.
- Run:
php bin/magento setup:static-content:deploy
You will see new css.
NOTE:
Give proper folder and file permission.
I hope this will help you.
add a comment |
- Remove pub static.
- Give
pub/static777 permission - Clear cache.
- Run:
php bin/magento setup:static-content:deploy
You will see new css.
NOTE:
Give proper folder and file permission.
I hope this will help you.
- Remove pub static.
- Give
pub/static777 permission - Clear cache.
- Run:
php bin/magento setup:static-content:deploy
You will see new css.
NOTE:
Give proper folder and file permission.
I hope this will help you.
edited May 4 '16 at 9:33
Siarhey Uchukhlebau
9,63692858
9,63692858
answered Dec 21 '15 at 11:35
denish vachhanidenish vachhani
3,3001938
3,3001938
add a comment |
add a comment |
do not forget to run the grunt exec:theme, grunt less:theme commands where theme is the theme you declared in the themes.js file from the config folder of grunt ( all this is in the developer guide ) and when you have magento in developer mode you shouldn't run the static deploy command, Magento2 works with Symlinks
1
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
add a comment |
do not forget to run the grunt exec:theme, grunt less:theme commands where theme is the theme you declared in the themes.js file from the config folder of grunt ( all this is in the developer guide ) and when you have magento in developer mode you shouldn't run the static deploy command, Magento2 works with Symlinks
1
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
add a comment |
do not forget to run the grunt exec:theme, grunt less:theme commands where theme is the theme you declared in the themes.js file from the config folder of grunt ( all this is in the developer guide ) and when you have magento in developer mode you shouldn't run the static deploy command, Magento2 works with Symlinks
do not forget to run the grunt exec:theme, grunt less:theme commands where theme is the theme you declared in the themes.js file from the config folder of grunt ( all this is in the developer guide ) and when you have magento in developer mode you shouldn't run the static deploy command, Magento2 works with Symlinks
answered Apr 19 '17 at 15:48
Vlad PatruVlad Patru
818416
818416
1
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
add a comment |
1
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
1
1
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
"when you have magento in developer mode you shouldn't run the static deploy command" <- This was extremely helpful to me. Thanks! I just deleted the contents of the pub/static directory (except for .htaccess of course), refreshed the page and symliks to my css files were automatically generated. Now I can edit them on the fly. Who said Magento 2 is not dev friendly?! Just need to know how to use it I guess.
– Rooster242
Aug 2 '17 at 21:37
add a comment |
There is one important note to make about this question that most of the answers don't specifically point out. In your case (with the set up you are using) the reason your CSS changes aren't getting picked up when you regenerate the CSS into the pub/static folder is you aren't removing the content of the var/view_preprocessed director. Inside this directory there are cached version of your CSS that are pulling into the pub/static folder when you run the php bin/magento setup:static-content:deploy command.
So when you recompile, Magento will first look to the var/view_preprocessed folder for the cached CSS. If this folder is empty, it will look to the theme files and pull that CSS for compilation.
These setting are configurable, so there are a lot of way to get to your destination that will change the path you need to take. But for the solution to your specific setup:
Remove the files from the
pub/staticfolder:rm -rf pub/static/*Remove the files from the
var/view_preprocessedfolder:rm -rf var/view_preprocessed/*Recompile the pub static folder:
php bin/magento setup:static-content:deployClear cache is it's turned on:
php bin/magento cache:cleanRefresh the browser.
1
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…
– circlesix
Jan 25 '18 at 14:04
add a comment |
There is one important note to make about this question that most of the answers don't specifically point out. In your case (with the set up you are using) the reason your CSS changes aren't getting picked up when you regenerate the CSS into the pub/static folder is you aren't removing the content of the var/view_preprocessed director. Inside this directory there are cached version of your CSS that are pulling into the pub/static folder when you run the php bin/magento setup:static-content:deploy command.
So when you recompile, Magento will first look to the var/view_preprocessed folder for the cached CSS. If this folder is empty, it will look to the theme files and pull that CSS for compilation.
These setting are configurable, so there are a lot of way to get to your destination that will change the path you need to take. But for the solution to your specific setup:
Remove the files from the
pub/staticfolder:rm -rf pub/static/*Remove the files from the
var/view_preprocessedfolder:rm -rf var/view_preprocessed/*Recompile the pub static folder:
php bin/magento setup:static-content:deployClear cache is it's turned on:
php bin/magento cache:cleanRefresh the browser.
1
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…
– circlesix
Jan 25 '18 at 14:04
add a comment |
There is one important note to make about this question that most of the answers don't specifically point out. In your case (with the set up you are using) the reason your CSS changes aren't getting picked up when you regenerate the CSS into the pub/static folder is you aren't removing the content of the var/view_preprocessed director. Inside this directory there are cached version of your CSS that are pulling into the pub/static folder when you run the php bin/magento setup:static-content:deploy command.
So when you recompile, Magento will first look to the var/view_preprocessed folder for the cached CSS. If this folder is empty, it will look to the theme files and pull that CSS for compilation.
These setting are configurable, so there are a lot of way to get to your destination that will change the path you need to take. But for the solution to your specific setup:
Remove the files from the
pub/staticfolder:rm -rf pub/static/*Remove the files from the
var/view_preprocessedfolder:rm -rf var/view_preprocessed/*Recompile the pub static folder:
php bin/magento setup:static-content:deployClear cache is it's turned on:
php bin/magento cache:cleanRefresh the browser.
There is one important note to make about this question that most of the answers don't specifically point out. In your case (with the set up you are using) the reason your CSS changes aren't getting picked up when you regenerate the CSS into the pub/static folder is you aren't removing the content of the var/view_preprocessed director. Inside this directory there are cached version of your CSS that are pulling into the pub/static folder when you run the php bin/magento setup:static-content:deploy command.
So when you recompile, Magento will first look to the var/view_preprocessed folder for the cached CSS. If this folder is empty, it will look to the theme files and pull that CSS for compilation.
These setting are configurable, so there are a lot of way to get to your destination that will change the path you need to take. But for the solution to your specific setup:
Remove the files from the
pub/staticfolder:rm -rf pub/static/*Remove the files from the
var/view_preprocessedfolder:rm -rf var/view_preprocessed/*Recompile the pub static folder:
php bin/magento setup:static-content:deployClear cache is it's turned on:
php bin/magento cache:cleanRefresh the browser.
answered Oct 15 '17 at 20:01
circlesixcirclesix
2,78421546
2,78421546
1
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…
– circlesix
Jan 25 '18 at 14:04
add a comment |
1
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…
– circlesix
Jan 25 '18 at 14:04
1
1
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
would be nice if magento2 would make symlinks to those affected files in developer mode, then changes in those module files where visible on the fly
– roman204
Jan 25 '18 at 8:06
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (
app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…– circlesix
Jan 25 '18 at 14:04
It does, but i haven't gotten my head around the when and the how, os i didn't bring this up in the answer. There are global config files that can set this in your di.xml (
app/etc/di.xml) file. But i have had mixed results while testing. There is a little more here in the second answer: magento.stackexchange.com/questions/116605/…– circlesix
Jan 25 '18 at 14:04
add a comment |
Couldn't you just flush static cache in the admin panel and then
run php bin/magento setup:static-content:deploy
add a comment |
Couldn't you just flush static cache in the admin panel and then
run php bin/magento setup:static-content:deploy
add a comment |
Couldn't you just flush static cache in the admin panel and then
run php bin/magento setup:static-content:deploy
Couldn't you just flush static cache in the admin panel and then
run php bin/magento setup:static-content:deploy
edited Nov 11 '17 at 11:17
Teja Bhagavan Kollepara
2,94841847
2,94841847
answered Nov 10 '16 at 3:12
babywitbabywit
374417
374417
add a comment |
add a comment |
However, you may add the -f or --force flag to the setup command.
Example:
php bin/magento setup:static-content:deploy -f
add a comment |
However, you may add the -f or --force flag to the setup command.
Example:
php bin/magento setup:static-content:deploy -f
add a comment |
However, you may add the -f or --force flag to the setup command.
Example:
php bin/magento setup:static-content:deploy -f
However, you may add the -f or --force flag to the setup command.
Example:
php bin/magento setup:static-content:deploy -f
edited Apr 4 '18 at 11:45
Dhaduk Mitesh
655218
655218
answered Apr 4 '18 at 9:00
Yamen AshrafYamen Ashraf
1694
1694
add a comment |
add a comment |
I'm gonna drop my wisdom droplet here.
I use a cache_fly.sh bash script which basically does:
#!/bin/bash
start=`date +%s%N`
./magento setup:upgrade &&
./magento cache:flush &&
./magento setup:static-content:deploy -f
end=`date +%s%N`
runtime=$(bc <<< "scale=9;($end-$start)/1000000000")
echo "" && echo "" && echo -e "e[34mTOTAL EXECUTION TIME: e[1me[93m$runtimee[0m"
NOTE: I've added an echo to show me how many time of my life I've wasted waiting for it to run.
Also ./magento is a script to do php bin/magento or call the same thing inside the docker container, if is docker used you could make yours or point to php bin/magento but if you're reading this you should know what I'm talking about, if not, please run asking for help.
add a comment |
I'm gonna drop my wisdom droplet here.
I use a cache_fly.sh bash script which basically does:
#!/bin/bash
start=`date +%s%N`
./magento setup:upgrade &&
./magento cache:flush &&
./magento setup:static-content:deploy -f
end=`date +%s%N`
runtime=$(bc <<< "scale=9;($end-$start)/1000000000")
echo "" && echo "" && echo -e "e[34mTOTAL EXECUTION TIME: e[1me[93m$runtimee[0m"
NOTE: I've added an echo to show me how many time of my life I've wasted waiting for it to run.
Also ./magento is a script to do php bin/magento or call the same thing inside the docker container, if is docker used you could make yours or point to php bin/magento but if you're reading this you should know what I'm talking about, if not, please run asking for help.
add a comment |
I'm gonna drop my wisdom droplet here.
I use a cache_fly.sh bash script which basically does:
#!/bin/bash
start=`date +%s%N`
./magento setup:upgrade &&
./magento cache:flush &&
./magento setup:static-content:deploy -f
end=`date +%s%N`
runtime=$(bc <<< "scale=9;($end-$start)/1000000000")
echo "" && echo "" && echo -e "e[34mTOTAL EXECUTION TIME: e[1me[93m$runtimee[0m"
NOTE: I've added an echo to show me how many time of my life I've wasted waiting for it to run.
Also ./magento is a script to do php bin/magento or call the same thing inside the docker container, if is docker used you could make yours or point to php bin/magento but if you're reading this you should know what I'm talking about, if not, please run asking for help.
I'm gonna drop my wisdom droplet here.
I use a cache_fly.sh bash script which basically does:
#!/bin/bash
start=`date +%s%N`
./magento setup:upgrade &&
./magento cache:flush &&
./magento setup:static-content:deploy -f
end=`date +%s%N`
runtime=$(bc <<< "scale=9;($end-$start)/1000000000")
echo "" && echo "" && echo -e "e[34mTOTAL EXECUTION TIME: e[1me[93m$runtimee[0m"
NOTE: I've added an echo to show me how many time of my life I've wasted waiting for it to run.
Also ./magento is a script to do php bin/magento or call the same thing inside the docker container, if is docker used you could make yours or point to php bin/magento but if you're reading this you should know what I'm talking about, if not, please run asking for help.
answered 7 mins ago
CJ GarcíaCJ García
11
11
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f94502%2fmagento2-re-generate-css-file-in-pub-static-folder%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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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
7
FYI: Magento 2 has a developer mode so you don't have to deploy static content all the time. I've wasted hours and hours in the past month redeploying static content. So don't be like me, and switch to developer mode (on your local machine. Your live server should be on production mode)
– Nathan Merrill
Dec 22 '16 at 14:40
why regenerate with different version??? I have an issue with deploy file version not match. magento.stackexchange.com/questions/94502/…
– Magento2 Devloper
Feb 20 '17 at 8:15
3
If magento is in developer mode it will create symlinks to the static files but for this to happen you have to have
.htaccessfile in thepub/staticfolder so it knows how to symlink files, if you deleted the pub/static folder that.htaccessis missing now– Vlad Patru
Mar 30 '17 at 7:16
@NathanMerrill you are so right but most of the dev's don't read documentation and all the answers and still run the static-content:deploy command and what is a bit sad is that some of the companies with account on Stackexchange provide answers like that, waste of time
– Vlad Patru
Apr 19 '17 at 15:53