less

How can I use media queries more efficiently with LESS?

我只是一个虾纸丫 提交于 2019-12-22 12:37:14
问题 I'm working with Bootstrap and LESS on a responsive webpage design. One of the reasons I have enjoyed LESS in the past is because it can keep all attributes for HTML elements together. What I have below is some rules to define a .sponsors block, and then one rule that applies to an element inside that block when the viewport is >= 768px I don't like how that one rule requires a lot of extra code, and how that rule is apart from the rest of the rules. It also feels wrong. What is a better way

Restrict mixin values and throw exception when invalid value is provided

爱⌒轻易说出口 提交于 2019-12-22 12:19:49
问题 I have the following Less mixin: .box-sizing(@value) { -webkit-box-sizing: @value; -moz-box-sizing: @value; box-sizing: @value; } and I would like to allow only the values 'border-box' and 'content-box' as parameter, otherwise the Less engine should throw an exception. How can I achieve this? Because without this validation I can write any value to the mixin and it will work, but it will also generate invalid CSS and no one will notice that there is an error. 回答1: As far as I know, there is

Can I call Twitter Bootstrap scaffolding spans inside my CSS as a mixin instead of a class?

五迷三道 提交于 2019-12-22 10:45:24
问题 I understand I can add a class="span3" to a div , but what if I want to give the equivalent attributes to another class via LESS? Example: <div class="span3">This width is span3</div> <div class="anotherClass">I want to make this also span3, but without explicitly calling it out</div> In LESS I want to do something like: .anotherClass { .span3(); } How can I do this? 回答1: The documentation says you can include any class or id ruleset by referencing it without brackets: .anotherClass { .span3;

Combining two .less files in one

倾然丶 夕夏残阳落幕 提交于 2019-12-22 08:54:52
问题 Suppose I have two less files, first.less .a { .b { font-size: 13px; } color: lime; } and second.less @import "first.less"; .a { font-family: sans-serif; } I would like a way of combining them into one, merging the trees: .a { .b { font-size: 13px; } color: lime; font-family: sans-serif; } So, something similar as compiling to .css , but keeping the .less structure. Is it possible to do via a command line tool, library or programmatically? 回答1: What @helderdarocha means, you can write native

How to make less to work with basset in laravel 4?

烂漫一生 提交于 2019-12-22 08:09:15
问题 How to enable Less compiling with basset? My basset config file collection: 'collections' => array( 'application' => function($collection) { $collection->apply('UriRewriteFilter'); $directory = $collection->directory('../app/assets/stylesheets', function($collection) { $collection->add('less/design.less')->apply('Less'); }); $directory->apply('CssMin'); } ); Everything else in config is untouched. In the source code i get this: <link rel="stylesheet" type="text/css" href="http://localhost/Job

How to autoprefix css files generated by less, in Webstorm?

眉间皱痕 提交于 2019-12-22 06:29:37
问题 I've got Webstorm 7 (on Win7) compiling my .less files into minified css with sourcemaps (using lessc on nodejs v0.10.26, run from a File Watcher in Webstorm), and I can then run autoprefixer on that generated css to automatically insert vendor prefixes. What I'm not sure how to do, is combine the two steps. Is it possible to chain File Watchers in Webstorm? Possible approaches: Create a batch script that is called from the file watcher, then calls less and autoprefixer in sequence. Create a

How to autoprefix css files generated by less, in Webstorm?

删除回忆录丶 提交于 2019-12-22 06:29:09
问题 I've got Webstorm 7 (on Win7) compiling my .less files into minified css with sourcemaps (using lessc on nodejs v0.10.26, run from a File Watcher in Webstorm), and I can then run autoprefixer on that generated css to automatically insert vendor prefixes. What I'm not sure how to do, is combine the two steps. Is it possible to chain File Watchers in Webstorm? Possible approaches: Create a batch script that is called from the file watcher, then calls less and autoprefixer in sequence. Create a

How do I automate the task of compiling front-end frameworks like Twitter Bootstrap in my Node.js project?

℡╲_俬逩灬. 提交于 2019-12-22 04:49:06
问题 How do I automate the task of compiling Twitter Bootstrap in my Node.js project? I'm editing the LESS files that compile into a custom build of Bootstrap for my Node.js project, so I can't just use the online customizer or the pre-compiled JavaScript/CSS distribution. How do I use something like Grunt or Bower to automate the process of building and compiling the Twitter Bootstrap front-end framework into my project from source? Is there a package manager for front-end libraries and

wp_enqueue_style and rel other than stylesheet?

白昼怎懂夜的黑 提交于 2019-12-22 04:27:06
问题 I create (or better try) to create my first WordPress theme with Less. What I do is to use a script like that into my functions.php wp_register_style('screen_css', get_bloginfo('template_url') . '/css/screen.less', array(), false, 'screen'); wp_enqueue_style('screen_css'); and the result is that: <link rel='stylesheet' id='stigma_screen-css' href='http://www.stigmahost.dch/wp-content/themes/stigmahost/css/screen.less?ver=1.0' type='text/css' media='screen' /> The question is, can I change

How to import styles in the right order in webpack

£可爱£侵袭症+ 提交于 2019-12-22 03:23:17
问题 I use bootstrap css and an additional template written in less. Im import both in the root component of my react component. Unfortunately the styles from bootstrap overrule the less styles even if the less files are the second ones that are imported. Is there a way to ensure the order of the styles with webpack. This is are the root component: import React from "react"; import Dashboard from "./dashboard"; import 'bootstrap/dist/css/bootstrap.min.css' import '../styles/less/pages.less' React