Changes to CSS and JavaScript applies only after deploying static content - magento

I installed Magento 2 from the Magento site. I have activated the developer mode by
{project directory}>php bin/magento setup:mode:set developer
Then I have installed my custom theme and finally I deployed my static content by
{project directory}>php bin/magento setup:static-content:deploy
My problem is I have to delete pub/static directory and deploy static content every time to apply the css and javacript changes. The static content deploy process is slow and taking so much time that it is very frustrating. I develop something and have to deploy to get the change to be appeared. Even for very small change. Flushing cache is not helping. Any help would be appreciated. Thanks in advance.

The grunt jobs should be enough to run when you change css.
So you can run:
grunt exec
grunt less
Or with specified theme name:
grunt exec:theme_name
grunt less:theme_name
Check in the database in core_config_data table and disable minify fields so Magento doesn't minify css / js while you develop. You can use this SQL query to disable those fields:
update core_config_data set value=0 where path in ('dev/css/minify_files', 'dev/css/merge_css_files', 'dev/js/minify_files', 'dev/js/merge_files')

Related

How to update scss on host

I have made a wordpress theme with understrap and I have uploaded on a webhost and it works fine.
The issue is that I wanted to make some changes so I edit my scss file localy and when I uploaded it the changes weren't applied. Am I suppose to upload any other file in order to work?
Thank you in advance
I don't know if this will help anyone but in order to update website's scss on host you simply copy the css file which usually is in the css folder and you just upload it to the same folder.
The SCSS needs to be compiled into - and replace the existing - CSS files enqueued by your theme. To do this you can either, install a plugin that does that, or have it done by setting up css pre-processing in your local IDE/environment.
clear cache of your browser and close recent tab and try again. it just browser runnung with previous cache.

Laravel project - When updating .vue file the changes don't show on live

On the right it shows the source code in dev tools live from the site, the left shows the actual .vue file content on the server.
As you can see nav-bar-icon20 {width:20px; height:20px;} has been removed, yet it still shows on the site.
Tried clearing browser cache, disabled cache in dev tools, ran php artisan cache:clear but nothing seems to work.
Thanks in advance.
Image left(source on server) and right(source from site dev tools)
Run
npm run watch-poll
to update the compiled vue file, wait for it to compile and then refresh the page

Drupal 8 disable theme.yml cache

When I change some info in theme.yml the chagnes are not activated on the site. The changes only are activated when I clean the cache on admin/config/development/performance. I have done all things from this and also tried using "Rebuild the theme registry on every page load" with Devel module. It did not help me. Is there any way to completely disable cache?
Did the drupal developers assume the theme developer should click the button every time he changes some theme option?
Open development.services.yml in the sites folder and add the following block to disable the twig cache:
parameters:
twig.config:
debug: true
auto_reload: true
cache: false
NOTE: If the parameters block is already present in the yml file, append the twig.config block to it.
Afterwards you have to rebuild the Drupal cache otherwise your website will encounter an unexpected error on page reload. This can be done by with drush:
drush cr
from: https://www.drupal.org/node/2598914
If you have drupal console installed, just put:
drupal site:mode dev

Magento 2 load very slowly after changing less file

I'm trying to create new theme. But every time I reload the home page it is going to high CPU loading.
My Settings:
New theme has just one file: /app/design/frontend/Test/default/web/css/source/_extend.less
Magento mode: developer
Front-end development workflow: Server-side less compilation
Grunt: installed and configured.
Activity monitor:
Chrome console:
And only after php bin/magento setup:static-content:deploy the page is loading fast:
Do I need to deploy static content every time I change some css style if I develop new theme?
Thanks in advance!
Yes ,You Have to load static content every Time whenever you do changes in css or js files,magento loads files only from cache,so even if you have done small change you have to deploy it so thet magento can load the changes on website

Magento 2 ignoring new theme

I am attempting to create my first Magento 2 theme.
I have created a new theme here:
/app/design/frontend/MyComp/MyTheme/
I copied the blank theme from /vendor/magento/theme-frontend-blank/ into MyTheme and then I created/edited various files, as per the instructions here.
In the Admin Panel I have gone into Stores > Configuration > Design and Ive set the theme to MyTheme.
However the front end it appears that my new theme isnt being used.
When I enable template path hints from the Admin Panel, the frontend shows that all the files are being got from here /vendor/magento/module-theme/view/frontend/templates/.
Can anyone explain why Magento 2 is ignoring my theme, and how I can fix this?
Many thanks in advance.
You were not configuring in the right place, and you did not run command after configuring.
After you create the theme, you have to configure in Admin: Admin > Content > Configuration > edit “Default Store view” http://prntscr.com/k5idnm, and choose your theme then select “Applied Theme”.
After that, run:
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
If after that, the theme still did not display correctly, you can back-up and delete folder pub/static/frontend, then run 2 commands above again and press Ctrl + F5 in your theme tab in your browser.
Clear cache after you've changed theme, running command in console:
php bin/magento cache:flush
Also if there is no files in your theme, Magento will use theme fallback system.

Resources