Magento 2: File path for changes in css - magento

I am new to magento 2 and I am making css changes in luma theme on below path.
But after content deployment I lost my css changes.
Please help me in that.
/pub/static/frontend/Magento/luma/en_US/css/styles-m.css
/pub/static/frontend/Magento/luma/en_US/css/styles-l.css

You should not edit/modify files within pub/* or vendor/* directory.
Pub is for deployment and vendor is for default structure, which you
override via your template or custom modules
Instead:
create a new theme inside app/design/frontend/{vendor}/{yourTheme}/.
You can use Blank or Luma theme
You can also create new theme which inherites from Blank (inheritance
is defined within theme.xml). If you are already using some theme
then skip this step.
edit .less within your theme so the changes stay visible and don't
get replaced when clearing the cache or upgrading the system.
Use grunt to compile your .less into deployment files.
You can also setup sourcemaps to pin point your styling within the
theme .less files so you can be more productive.
if you want to override only css file then you don't need to compile it. so follow above steps , change your css and clear the cache. it will worked.

Related

Hugo theme submodule marked as dirty, doesn't update

I'm using the Hugo Whiteplain theme for a personal site hosted through Netlify. I am following tutorial. When I push/publish on GitHub Desktop, I am told that my git submodule is dirty. As a result, I cannot change the theme's background color.
[submodule "themes/whiteplain"]
path = themes/whiteplain
url = https://github.com/taikii/whiteplain.git
What do I do to regain control of my theme? Can I change the color without dependence on this dirty submodule?
There are many ways to customize a Hugo theme. For instance, you can:
edit the theme directly and let it drift from the original project,
create a fork and use it as the theme to be able to pull updates
from the original theme while developing your own version,
edit the theme inside the website itself.
This last option means that you do not touch at the theme itself, but instead make a copy of any file you want to edit inside the tree of your website, following the same path structure, and edit that file.
For any element of any of the customization files (layout, css, scss, etc.) that exists both under the tree of your website and under the tree of the theme, Hugo will prioritize the element in the file under the tree of the website.
For any element not present in the tree of your site, Hugo will use what is in the theme tree instead. This means that you do not have to copy the entire theme or even entire files in your site, but only the elements that you want to customize.
If you choose this method and if you set your theme as a submodule following the Git submodule manual, you will never get into a dirty submodule situation.
Example
Let's say you want to edit the background color of your theme and that the variable is defined in a scss file under:
your_site
+ themes
+ theme_name
+ assets
+ scss
_content.scss
You need to keep the tree architecture and create a file under:
your_site
+ assets
+ scss
_content.scss
You can create a file from scratch, but an easier option is to copy the file from the theme and paste it there. In that file, you can customize the background color (or any other setting) however you like.
Note
I have found this way of customizing a theme (which is actually the way advised in the Hugo documentation) to be the simplest.
One situation where this method is not optimal is if you plan to use the same customized version of a theme for several websites. In that case, creating a fork of the original theme makes more sense as you can add your customized theme (your fork) as a submodule of all those websites and your customization is thus portable.

How do I customize go-present template?

I am new to Go and just stumbled upon Go's present package which I imported via go get golang.org/x/tools/present.
Is there any way to customize the look of the presentation? E.g. via adjusting the default css file?
If so where are the files used for the style? I cannot find the package anywhere in my Go path...
Let's assume you have a directory myslides with some .slide files in it.
Create a subfolder theme in myslides.
Copy the folders template and static from $GOPATH/src/golang.org/x/tools/cmd/present to that new theme directory
Start present with a new parameter -base: present -base theme
Modify the styles and template files. Most small things are in styles.css.
If you change the template files, then you need to stop and restart present. If your are changing the styles only, then a reload in the browser will do (take care to disable the cache.)
I found that the only way to change presentation styles is to modify library files directly.
If you use vgo:
$GOPATH/pkg/mod/golang.org/x/tools#<version>/cmd/present
Otherwise:
$GOPATH/src/golang.org/x/tools/cmd/present
Of cause first you need to download present package: go get golang.org/x/tools/cmd/present

Different color themes in Laravel 5.6/Bootstrap 4.1.0 application

In my laravel 5.6 / vue.js 2.5.7/ Bootstrap4.1.0 application I want to set different color themes and I found this collection https://github.com/thomaspark/bootswatch
But how correctly to set them to my project? I tried to replace files
node_modules/bootstrap/dist/css/bootstrap.css
node_modules/bootstrap/dist/css/bootstrap.min.css
and cleared cache and rerun
npm run watch-poll
But no effect... Which is the right way?
Are there some tools to change color themes programmatically, say depending on logged user options ?
Adding a link of one bootswatch file in my layout file resources/views/layouts/app.blade.php, like:
<link href="{{ asset('css/darkly/bootstrap.min.css') }}" rel="stylesheet">
I see that colors of my layout of my pages is different, but I mean that in this case I ADD this css/darkly/bootstrap.min.css file to the EXISTING(ORIGINAL) bootstrap.min.css
and now I have 2 bootstrap.min.css files in my system.
Is it good decision?
I supposed that creators of bootswatch meant to REPLACE the original bootstrap.min.css file. How do you think?
And that is the question where original Bootstrap css(and bootstrap.js to) are attached to the project ?
in my layout file resources/views/layouts/app.blade.php a line:
that is a ref to my custom css file, the styles I add to the project.
I did not find how to skip attaching of the original Bootstrap CSS file...
Thanks!
Bootswatch is not meant to REPLACE the existing bootstrap CSS file. It is meant to work and OVERRIDE the styling rules from the default one, which means, load bootswatch css after you load the bootstrap css.
It would also be advisable to rename your downloaded bootswatch CSS file.

How does BigCommerce Stencil Theme Editor bundle #import SCSS files?

When I use an #import statement that imports from a node modules folder, the import works perfectly.
#import "../../node_modules/bulma-scss/scss/utilities/functions";
However once a user goes to edit the theme via the backoffice theme editor and saves the changes, there is an error basically saying that that node_modules folder does not exist.
Expected Result
Editing a .scss file via the backoffice editor and 'save and apply' would successfully update the corresponding .css file used in the theme
Actual Result - https://www.screencast.com/t/RluUCmMq7Iqa
A string of 'file doesn't exist' errors occurs as the "#import" statements reference files used in the node modules folder
Video of issue explained: 1min 40s https://www.screencast.com/t/D4CvGQkk0cl
node_modules are available in the theme, but are not available when editing in the browser. The reason for this is that during "bundling", the contents of node_modules is converted into a different format and placed inside the /parsed directory.
When editing a theme in the control panel of a store, the contents of the /parsed directory/node_modules is not available to edit and not otherwise accessible.
I would recommend including the file through a non-package manage method in order to address this.

Have your custom theme exported in SemanticUI

Following documentation, I downloaded Semantic UI with:
npm install semantic-ui
then, I customised few variables per site, also few on element level, button for example.
This is all well, and I haven't had any problem changing those.
Then in theme.config file, I could specify:
#button: 'mytheme';
to pickup those custom style overrides
For my theme to be separate from Semantic UI core, I crated directory in the following path,
src/themes/mytheme
,and after running gulp build, I expected to have that mytheme exported over to dist/themes/mytheme along with basic and default which were already there. But that was not the case. So to be able to use my new button styles, I had to move manually newly generated button.css from dist/components after that gulp build task.
Am I doing this wrong? How to have all override files in one place like packaged theme? So I could then add <link> declaration after semantic.min.css to use my overrides.

Resources