less

Overriding Bootstrap variables without touching Bower

限于喜欢 提交于 2019-12-23 20:20:03
问题 How can I override the Bootstrap variables if I don't want to touch the Bower files? I am using Yo, Grunt, and Bower. For yo, I am using cg-angular. My app.less looks like this: @import "bower_components/bootstrap/less/bootstrap.less"; @import "bower_components/font-awesome/less/font-awesome.less"; @fa-font-path: "bower_components/font-awesome/fonts"; .... 回答1: Instead of including all bootstrap.less , copy his content to your app.less and import your own variables.less after bootsrap vars,

ASP MVC Less file gives: Exception has been thrown by the target of an invocation

亡梦爱人 提交于 2019-12-23 20:17:57
问题 I have a simple asp.net mvc 4 site that uses less files. When i run it on my local pc it works fine, but when i publish it to the server I get te following error: During the output text content of processed asset an unknown error has occurred. See more details: Exception has been thrown by the target of an invocation. stacktrace: [HttpException (0x80004005): During the output text content of processed asset an unknown error has occurred. See more details: Exception has been thrown by the

Concat and minify all less files with Webpack without importing them

不想你离开。 提交于 2019-12-23 20:16:09
问题 I have a folder of around 20 separate less files that I need to concatenate into a single file via Webpack and store this in my /dist folder. My current Webpack config file is as follows: const path = require('path'); const webpack = require('webpack'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin; const bundleOutputDir = './wwwroot/dist'; module.exports = (env) => { const isDevBuild = !(env && env

LESS css syntax error when referencing variable from namespace

99封情书 提交于 2019-12-23 19:17:58
问题 I'm getting a syntax error when attempting to reference a variable from a namespace in LESS: #testns { @my_color: #04ffff; .me() { color: blue; } } .fun { color: #testns[@my_color]; } The mixin works fine if I do the following: .fun { #testns > .me(); } But I'm not able to reference the variable from the namespace for some reason. I'm building these in Java using the asual library, and everything else is working perfectly. 回答1: This isn't how namespaces work. Namespaces allow you to declare

Using SASS & reference for OOCSS

痞子三分冷 提交于 2019-12-23 19:07:03
问题 Usually i use LESS for my projects but now im trying to go with SASS . In LESS i do things like this .module { background-color: blue; &-title { color: black; } &-type-2 { background-color: red; } } and the output CSS will be .module { background-color: blue; } .module-title { color: black; } .module-type-2 { background-color: red; } In SASS wont work, there is someway to do it in SASS? 回答1: As of Sass 3.3, you can do that with the following syntax: .block{ &__element { // ... } &--modifier {

calc() with variables not possible - SyntaxError: Operation on an invalid type

依然范特西╮ 提交于 2019-12-23 17:49:08
问题 I've got following LESS variables: @dashboard-height: 90.5%; @dashlet-header-height: 35px; @dashboard-margin: 0px; @dashlet-border: 1px; and I want to calculate following classes: .generate-dashlet-classes(6); .generate-dashlet-classes(@n, @i: 1) when (@i =< @n) { &.dashlet-@{i} .dashlet-content { height: round((calc(@dashboard-height - (@i * (@dashlet-header-height + @dashboard-margin + @dashlet-border)))) / @i, 6); } .generate-dashlet-classes-times(@i); .generate-dashlet-classes(@n, (@i + 1

来认识下less css

不想你离开。 提交于 2019-12-23 17:46:08
简介 感觉自己都out了,跟不上web时代的潮流了,前不久才刚接触这玩意,发觉lesscss在某些方面还挺有用的,说白了这东西就是一种动态的样式语言,语法类似于css,可以像java那样进行编译,生成你想要的对应css,并且less css扩展了css的动态行为。如,它可以设置变量(variables)、支持混合书写模式(mixins)、支持嵌套规则(nested rules)、也可像js那样进行属性值的操作(operations)、像js函数那样传递参数(functions)、 也具有变量的作用域(scope)等。 运行环境 lesscss可以在客户端,也可称 浏览器端 (IE+、Webkit、Firefox)、 服务器端 (node.js )上运行。 客户端 只需引入相关文件即可:如下所示 <link rel="stylesheet/less" type="text/css" href="less/demo.less"> <script src="js/less.js" type="text/javascript"></script> 其中less文件是你自己编写的less文件,强烈推荐使用sublime text3编辑器进行编辑,高亮的语法以及强大的插件支持不得不让人爱不释手,下载地址: sublimetext3官网 less可到官网上下载,当前吧版本是1.4.2:

How do I create a mixin using less.js that doesn't output in the final stylesheet

只谈情不闲聊 提交于 2019-12-23 17:10:35
问题 I'm creating some mixins in my less.js stylesheets where I don't want the original mixin to appear in the final output. For example, I have a couple of rules like this: .grid1 { width: 960px; } I'm then applying it to the element or elements I want to take those values like so: .foo { .grid1; } But then my final css file has both in. What facility does Less provide for creating the original mixin without rendering it as a css rule as well? 回答1: The best answer I can come up with seems to be

CSS @import statement

北战南征 提交于 2019-12-23 16:05:57
问题 I'm currently using the Initializr generated Bootstrap enhanced version of the HTML5 Boilerplate which also includes the LESS framework. Now the style.less is being included by the following line: <link rel="stylesheet/less" href="${resource(dir: 'less', file: 'style.less') }"> This works, but the line @import('bootstrap/bootstrap.less') fails, because it cannot find the bootstrap.less file in /static/less/bootstrap/bootstrap.less . However, the file is available without the static part. Is

How to require/import .less file in typescript file

梦想与她 提交于 2019-12-23 15:50:49
问题 I am trying to import a .less file in .ts file but I am not able to do that. I am using webpack2 as bundler & webstorm IDE Here snippet for less loader in a webpack.config.js file { test: /\.less$/, //less loader loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', //loader: 'css-loader!less-loader' loader: 'raw-loader!less-loader' }) }, { test: /\.ts$/, //typescript loader //include: path.resolve(__dirname, "ts-src"), include: path.resolve(__dirname, "js"), loader: "ts-loader"