I am using twitter bootstrap v 3.0 RC1 and I installed node and npm to compile less to css when I save the less file.
I include the bootstrap.css file into my html head, when I save the bootstrap.less, it compiles it into css like you would expect.
I created another .less file, (theme.less) within the same bootstrap/less directory where bootstrap.less resides with all the imports, thinking it would include those styles too, but it keeps giving me the following error when I try to compile the theme.less file:
NameError: .make-column is undefined in /path/to/assets/bootstrap/less/theme.less
/* ------- Theme styling ------- */
.content-body {
.make-column(10);
}
I assume it is undefined since theme.less does not have a clue the .make-column mixin is, I am new to this so I am trying to figure out how to do this correctly, thanks
Your code works (on linux)
create theme.less as above
add #import "theme.less"; at the end of bootstrap.less
compile by running grunt dist in your bootstrap folder or lessc bootstrap.less in your less folder
The result, the last lines of bootstrap.css contain:
/* ------- Theme styling ------- */
.content-body {
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
#media (min-width: 768px) {
.content-body {
float: left;
width: 83.33333333333334%;
}
See also: Twitter's Bootstrap 3.x semantic mobile grid
Related
I am new to SASS so please forgive me on my terminology and understanding. I am going through some tutorials on youtube and it has been great, the video is called 'Learn Sass In 20 Minutes | Sass Crash Course'. I am using visual studio code and what is tripping me up is the part where he has me create a _header.scss file along with _variables.scss as extensions of the main style.scss. Where the header from the style.scss is an #import 'header'; from the _header.scss using a #mixin variable.
I am running the live server on visual studio code and it will not update until I manually save all the files that I changed then also save the 'style.scss' in the end. Is there a way I could say modify the _header.scss file and _variables.scss and have it auto-update the style.scss?
If that doesn't make sense I will say it this way. I have a mixin variable and other '$variable's in my main style.scss file. When I make changes to the _variable.scss file and the _header.scss, is there a way I can just save these and have it automatically update the style.scss file as well? It is extremely time consuming having to go through and save them all to get it to do one update.
I tried making a key in VS code for 'Save All' multiple ways from online tutorial. Nothing works. I hope I am making sense, it is hard for me to explain being new to this. Thank you
style.scss
#import 'variables';
#import 'header';
.contact {
#include flexCenter(row, grey);
}
_header.scss
#mixin flexCenter($direction, $background) {
height: 25vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: $direction;
background: $background;
}
header {
#include flexCenter(row, rgb(31, 28, 28));
color: $textColor;
h1 {
color: $textColor;
}
button {
background: $primaryBtn;
&::after {
content: "o";
}
}
}
_variables.scss
$textColor: brown;
$primaryBtn: pink;
I had to delete both the include and exclude list in the settings. I then closed the workspace and opened the folder and now it works.
I am using Magento 1.9 and I am trying to edit the background color of the megamenu.
I navigated all the way to the .scss file but found a $menu-background at the place of the color hex..
.main-menu {
position: relative;
top: 0;
width: 100%;
left: 0;
z-index: 99;
background-color: $menu-background;
&.isStuck {
z-index: 9990;
.nav .grid-full > li > a > span{
margin: 10px 30px;
}
.nav .grid-full > .parent > a > span:after{
top: 80%;
}
}
}
at the beginning of the same scss file there was
#import "../includes";
so I searched for that file and found:
#import "var";
in that last file I found:
// Accent Colors
$accent-color-1: #ee372a;
$accent-color-2: #000;
$accent-color-3: #fff;
//Menu
$menu-background: $accent-color-2;
$menu-item-color: #888888;
$menu-item-color-act: #ffffff;
$menu-item-bg-act: #232323;
I edited the accent color 2 as follows : (blue instead of black)
$accent-color-2: #00427A;
However now no matter how much I refresh the page , press CTRL + F5, flush the cache from magento -> System Cache Management. I cannot see the color changing to blue. I searched a lot but couldn't find a solution.
I then realized that the files i edited were scss files and not css (I have very low knowledge about scss files).
The big issue now is to convert edited scss files into css files.
I tried:
-scout
-koala
-npm sass
and in all cases the #import is failing and the css is messing up.
Is there a button to easily compile sass to css in magento or another way to do it that would not mess the css when it finds an #import?
Magento 1 has no built-in scss compiler. You will have to compile them manually or check if your theme has some built-in module for this task.
you can obtain a compiler from npm
npm install -g sass
or get standalone one
https://github.com/sass/dart-sass/releases
the compilation process is easy. just find the source scss and specify the target file
sass source/<file>.scss skin/frontend/<theme-name>/default/css/<file>.css
Try using thos documentations for enabling SCSS in magento:
https://www.gomage.com/magento-2-pwa/resources/magento-pwa-documentation/tutorials/enable-sass-less-support/
or try this one:
https://www.gomage.com/magento-2-pwa/resources/magento-pwa-documentation/tutorials/enable-sass-less-support/
(I have searched various answers, but couldn't find anything relevant.)
I have two LESS files, say, file1.less and file2.less. file1.less contains import of file2.less. Files are compiled into .css OK so I have file1.css but the problem is that file2.less is ALSO compiled into file2.css besides its imported contents in file1.css. That is, I have duplicate contents of file2.less - in compiled file1.css and its own separate file2.css.
Is there any way to have file2.less imported and file1.less and NOT create its own file2.css? (I use WebStorm plugin compiler, if it matters.)
To make it visually clear, here's what I've got:
file1.less (e.g., contains body { font-size: 100%; } and "#import file2.less")
file2.less (let's say it contains body { background-color: #ffffff; })
RESULTS:
file1.css with
body { font-size: 100%; }
body { background-color: #ffffff; }
AND
file2.css with body { background-color: #ffffff; } (duplicate!!!)
How do I prevent file2.css from being created and just have it imported into file1?
This is something related to your compiler, not a LESS issue. I have never used this compiler of yours myself but I can suggest you to use http://winless.org/ if you are a Windows user (or less.app on Mac).
Winless watches a folder and subfolders for modifications (in .less files) and creates a ".css" based on the file you define as your bootstrap.
I'm using the Zurb Foundation toolkit, it contains two stylesheets, one being the app.css which is used for editing and adding elements. The following when added to the app.css do not reflect or update on my index page. From what I've seen this should be extremely simple but it hasn't worked for me. I'm using Aptana Studio 3.
body {
background-image:url('carbonfiber.png');
background-repeat:no-repeat;
background:#333333;
background-position:center;
}
#content {
margin-bottom:2000px
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:40px;
clear:both;
background-color:#C00 padding-bottom: 500px
}
You need to add the changes to the app.scss instead
Just do the following, open the command line: (leave this screen open while you work on your project)
compass watch your-project-folder
then any changes made to your .scss will be compiled into .css
With the zurb foundation, what I do is first create another file called _main.scss (under the sass folder) and then call it from within the /sass/app.scss file using #import main; any changes made to the _main.scss are compiled into a new stylesheet called /main.css and automatically added to the app.css file.
Hope it's clear.
I've been using compass with blueprint for a while now and one thing I can't figure out is why it generates all the basic blueprint css classes. Like these:
#container .span-3 { width: 110px; }
#container .span-4 { width: 150px; }
I specify --using blueprint/semantic when creating the compass project, and no I don't have #include blueprint anywhere in my source. Why are these classes being generated and how do I get compass not to include them?
I tried to reproduce your problem but I can't. Here's what I did and what I got:
compass create my_project --using blueprint/semantic
The generated screen.scss file seems to want you to #import "blueprint", as it contains the following lines initially:
// Import all the default blueprint modules so that we can access their mixins.
#import "blueprint";
The generated screen.css file does not contain .span-x anywhere, and the only place #container appears is in body.two-col #container {.
I modified the screen.scss file and recompiled. No change -- no non-semantic classes showed up in screen.css.
Hope this helps...
(Tested with Compass version 0.11.5, Ruby 1.8.7, FreeBSD 8.2)