I want to specify compiler switches for a certain directory only in premake.
Now AFAIR, I think I should have to use buildoption for the switches.
So I would await:
configuration { "vs2010" }
files { "mysubdir/**" }
buildoption { "/wd4244" }
Sadly this does not seem to work. Is this even possible with premake?
If you are using the latest development version of Premake, you can do it like this:
filter { "files:mysubdir/**" }
buildoptions { "/wd4244" }
I don't recall if per-file build options were supported in Premake 4.x, but if so it would work like this:
configuration { "mysubdir/**" }
buildoptions { "/wd4244" }
Related
.name {
%common {
// common stuff
}
&__first-type {
#extend %common;
// first type thing
}
enter code here
&__second-type {
#extend %common;
// second type thing
}
}
I want to collapse all thing in name class
(first-type, second-type, and also a common part)
but I don't want anything more in the executed CSS file.
.name__first-type, .name__second-type {
//common thing
}
.name__first-type {
//first type thing
}
.name__second-type {
//second type thing
}
can I do this thing without separating non-executable common(%common)?
It is possible to generate those two class like this.
%name__common {
// common stuff
}
.name {
&__first-type {
#extend %name__common;
// first type thing
}
&__second-type {
#extend %name__common;
// second type thing
}
If you mater nice project architecture you can either put this %name__common{...} in partial file such as _commons.scss
or try to change your project coding style.
So I'm currently doing some styling, following the BEM standard.
An example of what I'm doing could be this:
.block{
&__element {
}
}
what i would like to do is this:
// file a
.block {
...
}
-
// file b
// add magic to reference the `block`class in file a
&__elelemnt {
...
}
What I'm currently doing:
// file a
.block {
...
}
-
// file b
.block__elelemnt {
...
}
(manually adding the block part to the name)
Is there any way to reference this in a smarter way?
Thanks in advance
You can have this file structure:
block-1/
--block-1.scss
--element-1.scss
--element-2.scss
block-2/
--block-1.scss
--element-1.scss
--element-2.scss
And import elements files info block files.
block.scss:
.block {
color: red;
#import "element-1.scss";
#import "element-2.scss";
}
element-1.scss:
&__element-1 {
color: green;
}
Compiles to:
.block {
color: red;
&__element-1 {
color: green;
}
}
This is perhaps the best you can do.
$namespace: "block";
.#{$namespace}-myClass {
...
}
OUTPUT
.block-myClass {
...
}
You can keep a variable $namespace at the top of your file or in a different file and import it. The advantage of using a variable is you can update it once and all your references will be updated.
SASS is all about DRY.
As in, if you want to modify anything, you should be able to modify it from one single place. If you need anything available across multiple files, consider defining its value in a _vars file and including it everywhere you need it. Also note this has nothing to do with code shortness, but with code maintainability and flexibility.
In fact, even if you do get to write more code (which, in practice, doesn't happen), the advantage of DRY far outweighs it.
Here's how it should be done:
/* _vars.scss: */
$block:block;
/* a.scss: */
#import _vars;
.#{$block} {
...
}
/* b.scss: */
#import _vars;
.#{$block}__element {
...
}
Now, whenever you need to change block value, you can do it from one place: _vars.scss.
But, in practice, most people use the initial technique (nesting):
.block {
...
&__element {
...
}
}
Chances are .block and .block__element are related and, overall, it makes more sense to put them in same file. As your app grows in complexity, you'll find it harder to keep track of your code if you over-complicate it.
I am currently adding support of QWebEngineWidgets to my older applications but I don't want to loose QWebKitWidgets. because in some embeded platforms the qt version is still 5.3. I wonder if the following solution I made by myself is correct and better solutions is also welcome.
equals(QT_MAJOR_VERSION, 5) {
lessThan(QT_MINOR_VERSION, 5) {
QT += webkitwidgets
}
greaterThan(QT_MINOR_VERSION, 4) {
QT += webenginewidgets
}
}
You can also use "else" for the alternative branch, e.g.
lessThan(QT_MINOR_VERSION, 5) {
} else {
}
or even check for a module's availability specifically
qtHaveModule(webengine) {
}
H I, Working with Less and here is what I am hoping :
.createClass() {
#varone:one;
#vartwo:two;
#classname: #{varone}_#{vartwo};
.testClass_#{classname} {
padding:.5em;
}
}
.createClass();
Things I have tried from a few searches :
#classname: '#{varone}_#{vartwo}';
But this renders as:
.testClass_'one_two' {
padding:.5em;
}
And I read about the tilder ~ ( but might be just for the phpless I found off a search ? )
#classname: ~'#{varone}_#{vartwo}';
didn't run.
I am running on node , compiling via the grunt less contrib
How do I render a 'unquoted string' in this way / is it possible ?
Many Thanks,
#classname: ~'#{varone}_#{vartwo}'; (or same with double quotes) is the correct syntax and works in all conformant Less compilers. I.e.:
.createClass() {
#varone: one;
#vartwo: two;
#classname: ~'#{varone}_#{vartwo}';
.testClass_#{classname} {
padding: .5em;
}
}
.createClass();
Ahh I found it.
http://lesscss.org/functions/#string-functions
Can use:
#classname: e(#{varone}_#{vartwo});
The e(str) filter does it
Bit more RTFM was needed from me !
Related to How do I add a .properties file into my WAR using gradle? but not quite:
I've got one project, call it 'webclient' that produces:
build/out/WEB-INF/deploy/foo
build/out/client/bar.js
build/out/clientDebug/baz.js
and then I've got a war project, call it 'server' that I'm trying to include the above into the a few different directories by doing:
war {
from files(project(':webclient').file('build/out/WEB-INF')) {
into('xxx')
}
from files(project(':webclient').file('build/out/client')) {
into('yyy')
}
from files(project(':webclient').file('build/out/clientDebug')) {
into('zzz')
}
}
...but that doesn't work. I end up with all the contents under zzz/ ! Am I doing something wrong? bug in gradle (1.0-m6, btw)?
I didn't digged deeper in the details, but the files() method seems to cause the problems here. The following workaround should do the trick for you:
war{
from (project(':shared').file('build/out/WEB-INF')) {
into('xxx')
}
from (project(':shared').file('build/out/client')) {
into('yyy')
}
from (project(':shared').file('build/out/clientDebug')) {
into('zzz')
}
}