LESSCSS: how to compile using last version and grouping media queries - compilation

I usually develop LESS code using JS compiler in DEV environment, so I compile CSS only when going to PRODUCTION one.
I have 2 needs compiling LESS into CSS:
Compile LESS not automatically, but only when I manually want to do it, but using always last version of compiler released (often tools like WinLess have not up-to-date versions)
Auto-merging media queries (using media queries inside nested rules, results in numerous repetition of the same media query. Compiler should detect it and group all css declaration inside a unique media query )
How to do that? (possibly without node.js, I don't have it)

Less runs inside 3 environments: Node, browser and inside Rhino. Currently there is no Rhino support for v2, alternatively you can use https://github.com/SomMeri/less4j, see How do I build the Rhino specific versions of less?.
Some PHP ports are available at http://lessphp.gpeasy.com/ and http://leafo.net/lessphp. Both ports seem not to be able to run the latest version of Less. Also #media merging does not work with PHP, see: Group multiple media queries formed as output of LESS css
I wrote "possibly without node.js" :D Anyway.... I read about
possibility to use Grunt instead to do the same task. Please, what's
the difference between two approaches? thanks
Grunt (and Gulp) are both JavaScript task runners and require Node.js too:
Grunt and Grunt plugins are installed and managed via npm, the Node.js
package manager. Grunt 0.4.x requires stable Node.js versions >=
0.8.0.
No, the easiest way to solve your issues is getting Node.js:
Install Node.js (which includes npm), see https://nodejs.org/download/
Then you in your console (command prompt) npm install -g less. Mac users should run the Terminal.app and Windows users can use the cmd command.
Now you can compile your less files as follows:
>> lessc main.less main.css
Auto-merging media queries:
Clean-css supports #media merging since v3, and so does the less-plugin-clean-css. So run in your console:
npm install -g less-plugin-clean-css
Now you can compile your less files as follows:
>> lessc --clean-css="advanced" main.less
less-plugin-clean-css sets the --skip-advanced true by default you should explicit set the advanced option for #media merging

Related

IntelliJ Mac - LESS Compiling with Autoprefixer

I was using a file watcher in IntelliJ which automatically compiled my less files into css files. I added an argument to the file watcher which used the autoprefix plugin to add all the prefixes to the compiled css file.
I now switched from a windows machine to mac and I can't get it to work like this there. I installed the autoprefix plugin via npm: https://github.com/less/less-plugin-autoprefix
And I set everything like it was on my windows machine: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000659610-Autoprefixer-in-file-watcher
But now I only get the error message:
"Unable to load plugin autoprefix please make sure that it is
installed under or at the same level as less"
Same error occurs when calling the compiling with plugin from the command line. LESS compiling itself is working fine.
Does anyone has an idea what I'm missing? I'm pretty new on Mac so I don't know if I miss some environment variables or something? Or how can I check where the plugin is installed and where do I have to install it?
Thanks to an answer which seems to has been deleted in the meantime I found the solution.
The current autoprefix plugin needs an older version of less. It's not compatible with less 3.0.1.
After uninstalling less and installing version 2.7.3 with
npm install -g less#2.7.3
it is working again.
Found the solution here: https://github.com/less/less-plugin-autoprefix/issues/30

Can Elixir or Erlang programs be compiled to a standalone binary?

It says that Elixir has a tool called elixirc and Erlang has a tool called erlc to compile modules for use. It says immediately after this that you can then run code with the elixir command line tool.
Is there a way to compile a binary executable with Elixir or Erlang? (one which I can chmod +x binary_name and then run from the same directory with ./binary_name)
Escripts support that to some extent but you still need Erlang installed in your machine. See this answer for more information: Elixir or Hex portable package format?
Make sure you checkout Distillery. It does what you need, without having to deal with Rebar.
Add this to your mix.exs file's dependencies then run mix release.
defp deps do
[{:distillery, "~> 0.9"}]
end
Their documentation is great:
Home - Distillery Documentation
You can use tools like rebar to generate a release that also contains the erts, which makes it possible to run said release on a machine where erlang is not installed. But the erts included corresponds to the operating system on which the release was built, i.e. windows binaries if built on windows.
You can use Elixir's built-in releases as of Elixir 1.9. It is a lightweight alternative to Distillery.
Caveats:
It will not create anything remotely like Go does with a single binary executable that you can run almost anywhere. Also your target will have to match the CPU architecture and OS.
To build a release run:
mix release
Read more here:
https://hexdocs.pm/mix/Mix.Tasks.Release.html
There are a few tools now that allow you to create a self contained executable binary that doesn't require any dependencies on the target machine. They support multiple platforms.
Bakeware: https://github.com/bake-bake-bake/bakeware
Burrito: https://github.com/burrito-elixir/burrito

Running PyPDFOCR on Windows via Python - Requiring Poppler?

I'm working on a project that requires the conversion of PDFs into their searchable counterparts, and have found that PyPDFOCR does exactly what I need to get the job done. However, when trying to install the module and its external dependencies, I'm running into issues where I can't download anything windows-related that defines pdfimages such as Poppler. I've search all around for any ways to install Poppler in order to run the module, but nothing seems to be supported or working. Any ideas?
Have you tried the Poppler download from:
https://sourceforge.net/projects/poppler-win32/ for Windows platform
https://poppler.freedesktop.org/ for Linux platform

Gradle using terminal with Android Studio install on Ubuntu 12.04

Can not get the terminal commands to work with gradle. I am trying to get Gradle to work outside of Android Studio as a prelude to scripting up various flavors of my app. I got the flavors to build within Android Studio but I find the interface confusing.
Gradle was installed either with ADT or Android Studio at: /home/mark/.gradle
Would like to use the install of Gradle at /home/mark/.gradle. Would like to avoid the Gradle in the repo since Android Studio updates frequently and their a possibility that I could wind up with two different versions of Gradle that could cause more headaches.
So far I have tried setting the PATH various ways in .bashrc bash.bashrc environment
files. Nothing worked.
Not sure if I put the wrong terms/commands in those files or the files are wrong ones. Tried the gradle term with and with out the dot as well. I would appreciate explicit instructions on terms/commands and in what files.
The gradle executable is usually installed here (when installed by by android-studio):
<user_home>/.gradle/wrapper/dists/gradle-<version>-bin/<some_key>/gradle-<version>/bin/
So be sure that your PATH variable include this path.
Alternativelly, you can download the gradle distribution, unzipping it in a more convenient location and use that location in your PATH.
Wathever your choice is (i.e. using the gradle installed by Android-Studio or download and install a distribution of gradle yourself) : you have to take care to maintain your PATH variable up-to-date when you install a newer version of Android-Studio.

Update SASS in Netbeans JRuby?

I am using the SCSS-Editor for Netbeans on Windows so that I can edit and compile SCSS files in my projects. SCSS-Editor uses a bundled install of SASS/JRuby, although there is an option to use an external one (I'd prefer not to install the whole Ruby environment just for compiling SCSS files so the bundled one seemed ideal).
For the most part this works fine and I am enjoying using SCSS in my latest project. However, it seems some features of the language (i.e. the %class-name extends) may be unavailable to me due to the bundled SASS being an old version (3.1.20).
I've had a go in the command line (running as admin), but it isn't responding (cursor just there like it expects more). How can I go about updating the bundled SASS install that Netbean's JRuby is using?
Or is there an alternative solution (apart from installing Ruby or using ScoutApp)?
Many thanks
I've done this, but I should add as a disclaimer that I haven't conducted any thorough testing. That said, what I've done seems to work okay.
The "External Runtime" setting is just for the SASS runtime; the embedded JRuby version is still used so there's no messing around with Ruby installation. If you go to the SASS code archive on RubyForge and download and extract the latest tar version (stable is currently 3.2.9) to some appropriate folder, that folder is then suitable for the Sass plugin's "External Sass runtime" location.
The setting (I know you're aware of this, but just to make the answer complete) is in Tools->Options->Misc->Scss and put the folder you created into the SASS/HAML home box which appears when you select External Sass Runtime.
Obviously, there is potential for problems with new SASS on old JRuby and even new SASS on old SCSS-Editor, but my projects seem to compile okay.

Resources