G
G
grishaaa2014-12-22 14:52:31
css
grishaaa, 2014-12-22 14:52:31

(bootstrap version 3.3.1) how to configure less to css compilation?

Hello, I'm using bootstrap 3.3.1 and I want to use less to change styles in bootstrap 3.3.1, but I don't know how to set it all up to make it work. Please tell us everything in detail how to connect less.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2014-12-22
@grishaaa

1. Create a style.less file in which you import the necessary bootstrap files (let them be in a separate folder so as not to get confused). For example:

@import "bootstrap/less/variables.less"
@import "bootstrap/less/mixins.less"
@import "bootstrap/less/normalize.less"
@import "bootstrap/less/mixins.less"
@import "bootstrap/less/buttons.less"

You can see the list of all files in bootstrap.less . If you need the whole bootstrap, you can just import this bootstrap.less.
2. Write your styles after imports or in a separate file, and include it in style.less with an import:
// Bootstrap
@import "bootstrap/less/variables.less"
...
@import "bootstrap/less/buttons.less"

// Project Styles
@import "project.less"

3. Compile LESS to CSS using the less npm package or the Prepros utility , as suggested . Include the resulting CSS file in your page.
To better understand LESS, you can take the online course Introduction to LESS .

A
azzaro, 2014-12-22
@azzaro

npm install -g less
lessc styles.less > styles.css

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question