Django + Mac osx how to use less css? - css

There is no less css command line compiler in mac osx. But I am trying out a project which needs to use less css.
Also less is used to compress the css files in the project. How do I handle this? I read in less website that its js can be run on a node.js server - http://lesscss.org/#-server-side-usage
But I am not understanding how to integrate it with django. What should be the value for the COMPRESS_PRECOMPILERS ?
COMPRESS_PRECOMPILERS = (
('text/less',""),
)
Any help appreciated from someone who has already solved this problem.

Install node.js and npm (I used homebrew to install node.js and the instructions at http://npmjs.org/ to install npm)
Install the command-line less compiler with npm install --global less
Add lessc to COMPASS_PRECOMPILERS (directions).
Here's the relevant snippet:
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} {outfile}'),
)
Also, COMPRESS_PRECOMPILERS is from django_compressor, a django app, not from django itself. I think django_compressor looks quite good, but there are other options available as well.

Have you tried the less.app for OS X?
http://incident57.com/less/

Related

Getting started with 2SXC Bootstrap 4 Instant Theme

I've installed Bootstrap 4 Instant Theme on my dev machine, which has DNN installed. I can get the theme up OK.
I've installed Node.js and that looks OK.
I've run npm ci in the app/theme folder, and that seems to have run OK. There is a webpack.config.js file in the folder.
I don't get the "run webpack" instruction!
When I make changes to the _variables.scss file and save and then refresh my page, I don't get the theme updates.
The Client Resource Management was already disabled.
I've cleared the cache and restarted the application.
What am I missing, or what is missing from the documentation that it assumes I know?
Just to be sure: did you compile the scss? As Bootstrap 4 uses SASS, the scss need to be compiled in order to take effect.
Try
npx webpack --config webpack.config.js
cmd is enough to run the command. I use a .bat with this to quick compile.
run npm run webpack from commandline.
I have extended the instructions and explained the step better. I hope you were able to move on by now.
João Gomes, thx for your quick answer =)

WebStorm: LESS not being compiled on Mac

I have installed WebStorm 9 on Mac. I am having problems getting my LESS code compiled to CSS even after installing the LESS Compiler plugin.
The following message gets displayed:
"Missing CSS Output Directory - You can add CSS output directories under Settings > Project Settings > LESS Compiler"
Though there is no "Project Settings", I have add out put directory to LESS Compiler in "Settings".
It still does not work.
Known issue - see https://github.com/acdvorak/intellij-lessc-plugin/issues/47.
I can suggest using less compiler (npm install -g less) configured as a file watcher instread - see https://www.jetbrains.com/webstorm/help/transpiling-sass-less-and-scss-to-css.html
I also meet the problem in mac WebStorm, finally found where is wrong:
WebStorm Less compiler only work for ver. less 1.6.2
please use below under your project:
sudo npm install less#1.6.2
then in File Watchers in WebStorm to edit Less watcher,
in Program field change path to:
yourProjectPath/node_modules/less/bin/lessc
then happy css will appear. :)

Compile LESS file into CSS Bootstrap 3

I have a LESS file which I want to compile to use as my bootstrap theme. How can I compile it? Is there a place where I can do this?
The less FILE comes from http://bootswatchr.com/ but when I click the link get CSS and choose either minified version or complete version, nothing happens.
I have the LES file from the left pane, is there a way I can still compile it?
Install node.js
Install the Less compiler: npm install -g less
Run the Less compiler on your Less source to produce CSS: lessc your-source.less > output.css More info: http://lesscss.org/#using-less
If you are using WebStrom IDE, then it has a plugin for LESS to compile. I have been using the plugin to compile the LESS over a year.
If you want software, then I would recommend SimpLESS. You can use it on OSX/Win. It has drag and drop support which is nice and will tell you if your syntax is wrong. It also updates to support the latest LESS version.

Installing Sass on PC with no command line knowledge

I'm going through the Sass tutorial and am stuck at this part:
Once you have Ruby installed, you can install Sass by running
gem install sass
So I opened up command prompt and typed in
gem install sass
Just like it said. It doesn't work though. I get this message back:
'gem' is not recognized as an internal or external command, operable program or batch file.
I have almost no knowledge of command line but wish to use Sass. Can someone please walk me through what I'm doing wrong?
Yes I did searches for tutorials for people who don't know command line. I only came up with a Mac guide, which does me no good since I'm on Windows 8, and a program that my company has blocked access to.
This just means the gem executable is not in your %path%. You can either run the ruby installer again and select the check box during the install for "Include ruby in path" (or some similar message) or just add the path (something like C:\Ruby200) to your system %path% variable.
Use Ruby Installer for Windows to install Ruby. After that you'll be able to do gem install sass.
Also, i recommend you get familiar with Compass as soon as possible. Compass is a very ambiguous thing for newcomers, so here's an explaination for you: Import common modules by default when compiling SCSS
And here's a great source of information for SASS newbies: https://github.com/Snugug/training-glossary/wiki

Installing Sass on Gentoo

I've been trying to install Sass on Gentoo, but it hasn't been going too well. Unfortunately, the latest version of Sass in portage is 3.1.21.
What I want to use Sass for requires at least Sass 3.2, which is available through rubygems.
What I've tried:
emerge dev-ruby/sass (installs an old version)
gem install sass
The second command appears to install the Sass gem. However, I do not use Rails or Ruby in any other aspect apart from Sass, so the gem appears useless to me. In addition, I do not know where gems are installed to or how to use them (I'm a ruby noob.) All I want to do is call sass from the command line.
Are there any ways to obtain an up-to-date version of Sass which I can just use from the command line?
Cheers.
On Gentoo, user-installed gems are not in your PATH by default. I have created a bug report because while user-installed gems work much better than they used to, this problem really needs to be rectified. You can help by voicing your opinion in the report and linking back to this page. To get things working, you can either deploy the script I uploaded to the report or use RVM instead, which will give you much more consistent behaviour across distros.
I'm wondering but all the answers looks weird for me. One of the biggest gentoo advantage is ebuild writing which is easy as pie so every user can contribute whatever he needs.
Add local overlay
fork upstream ebuild to your local overlay
bump version
use
test
attach tested ebuild to bug report, maybe also contact someone on #gentoo-dev-help
Trust me, using gem (or cabal, or whatever) instead of your package manager if way to mess your system.
Some might find useful to know that under Gentoo you can install sass using emerge which will solve the PATH problem some people are encountering.
# emerge -av sass
after which you should be able to use sass without problem.
Another solution would be to use rvm which could make things more portable and uniform across environments.
edit: in case someone's asking: to install rvm just follow the instructions found at: https://rvm.io/rvm/install/ and install the stable version.
I don't see a down side to using the gem version of Sass. I'm also not a Ruby/RoR developer (I use Haskell/PHP), and I just use the gem. I know just enough about gems to install/uninstall them, and that seems good enough for using Sass.
Installing and upgrading Sass is done with the same command:
sudo gem install sass
Installing Sass via gems gives you the ability to use it via command line, just like it shows on the official website: http://sass-lang.com/.
sass --watch style.scss:style.css
Other command line options can be found via --help or on their docs: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#using_sass
sass --help
Consider using compass it will accepts command lines like: compass [YOUR-FILE].sass and can also compass watch [SASS FOLDER] and 'compile' css to it.
http://compass-style.org/
To install using a gem
gem update --system
gem install compass
Installation

Resources