Laravel - Bootstrap - NPM Watch is not replacing css matches, it's adding - npm

Laravel 8 - Bootstrap 4
I have two Laravel projects. One created and running in docker, the other created and running in Vagrant/Homestead. The setups are almost the same otherwise.
However, in my vagrant/homestead project, when I use variables in my app.scss file like these:
$theme-colors: (
"blue": #007bff,
"indigo": #4B0082,
"purple": #6d388c,
"pink": #e83e8c,
);
What compiles into my app.css file, is duplicated for the items above, like this:
:root {
--blue: #3490dc;
--indigo: #6574cd;
--purple: #9561e2;
--pink: #f66d9b;
--blue: #007bff;
--indigo: #4B0082;
--purple: #6d388c;
--pink: #e83e8c;
}
With my colors lower in the file. The end result is the same, as the lower variables take precedence, and they aren't double processed into the classes where they are included either.
It seems something is wrong, as this does not happen in my project on the docker install. Is it possible that the mixin (or...) rules changed to now include the duplicates? Hard to guess that is true.
I don't believe docker or vagrant has anything to do with this, I'm just using those specifics to keep clear which is which.
Any ideas? Thanks.

Related

Change case of folder using libgit2sharp

How can I rename a directory in libgit2sharp (under Windows, which is case insensitive) when it's just a case change?
This code works fine for moving files across different directories:
File.Move(#"C:\repo\folder1\file.txt", #"C:\repo\folder2\file.txt");
repo.Index.Remove("folder1/file.txt");
repo.Index.Add("folder2/file.txt");
repo.Index.Write();
var commitResult = repo.Commit(logMessage, author, author);
However, if I'm just renaming case of a folder, it doesn't work:
Directory.Move(#"C:\repo\folder1\", #"C:\repo\Folder1\");
repo.Index.Remove("folder1/file.txt");
repo.Index.Add("Folder1/file.txt");
repo.Index.Write();
var commitResult = repo.Commit(logMessage, author, author); // nothing gets written - I get LibGit2Sharp.EmptyCommitException
I also tried doing 2 renames (and commiting once at the end) like suggested by this answer
Am I doing something wrong or this is a git limitation?
Is there any workaround besides doing an intermediate commit?
PS: I tried changing the repo to ignorecase=false (the default in Windows is true), but it didn't work either.
Turns out that it was enough to set ignorecase=false in git.config - but I had to use that since the beggining (before the first commit).
I only tried changing that setting by the moment that I was really removing the old case and adding the new one, looks like that wasn't enough - git doesn't detect the change.

Can CPACK_INSTALL_CMAKE_PROJECTS be used for selective install?

For my application, I created 4 components, and want to 'install' only the applications and their docs. According to https://cmake.org/Wiki/CMake:CPackConfiguration, if in my config file I have the line
set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
then all the four components are installed. If I use the component names instead like
set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_PROJECT_NAME};apps docs;/")
I receive a package with no component name appended, and it contains the top level requested directory but no files at all. If I provide only one component like
set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_PROJECT_NAME};apps;/")
the package name does not contain the name of the component, but the files are generated in their right position.
What do I wrong?
EDIT: Just to add more strange things:
For the ALL case 4 files with names install_manifest_+comp name are created. For the second case I have install_manifest_apps docs.txt of zero length, and for the third case I have install_manifest_apps.txt, with the right content.
It seems to me that the macro can only accept one argument which can be either ALL or a component name; this means it cannot be used to install a 2-component system.
Moreover: if I use a component name, make package only produces that one package, without appending the component name, but with the right content. Till now I guessed that make install and make package are independent.
Set multiple values to CPACK_INSTALL_CMAKE_PROJECTS, one for each component you want to include:
set( CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_CURRENT_BINARY_DIR};${CMAKE_PROJECT_NAME};apps;/"
"${CMAKE_CURRENT_BINARY_DIR};${CMAKE_PROJECT_NAME};docs;/"
)

Accessing custom jbake confing properties in asciidoc

After some time I spent staring at the jbake code, I figured out that if I declare my own property in jbake.properties :
...
foo=bar
...
I can reuse that in files that go through a template engine by referencing it as ${config.foo}. I'd like to have this substitution working also on the content lvl, i.e. for files written in asciidoc, living inside the content directory.
Is there any non-trivial way to achieve it? How can I make the templating engine to proccess the result of asciidoc parses engine, or make it running it before the asciidoctor?
I found the answer myself.
To use the property substitution in asciidoc files, add following to the jbake.properties:
...
asciidoctor.attributes.export=true
foo=world
...
and reference the variable in aFile.adoc this way:
Hello {foo}!

Querying for shared nodes in JCR (ModeShape)

I have a JCR content repository implemented in ModeShape (4.0.0.Final). The structure of the repository is quite simple and looks like this:
/ (root)
Content/
Item 1
Item 2
Item 3
...
Tags/
Foo/
Bar/
.../
The content is initially created and stored under /Content as [nt:unstructured] nodes with [mix:shareable] mixin. When a content item is tagged, the tag node is first created under /Tags if it's not already there, and the content node is shared/cloned to the tag node using Workspace.clone(...) as described in the JCR 2.0 spec, section 14.1, Creation of Shared Nodes.
(I don't find this particularly elegant and I did just read this answer, about creating a tag based search system in JCR, so I realize this might not be the best/fastest/most scaleable solution. But I "inherited" this solution from developers before me, so I hope I don't have to rewrite it all...)
Anyway, the sharing itself seems to work (I can verify that the nodes are there using the ModeShape Content Explorer web app or programatically by session.getRootNode().getNode("Tags/Foo").getNodes()). But I am not able to find any shared nodes using a query!
My initial try (using JCR_SQL2 syntax) was:
SELECT * FROM [nt:unstructured] AS content
WHERE PATH(content) LIKE '/Tags/Foo/%' // ISDECENDANTNODE(content, '/Tags/Foo') gives same result
ORDER BY NAME(content)
The result set was to my surprise empty.
I also tried searching in [mix:shareable] like this:
SELECT * FROM [mix:shareable] AS content
WHERE PATH(content) LIKE '/Tags/Foo/%' // ISDECENDANTNODE(content, '/Tags/Foo') gives same result
ORDER BY NAME(content)
This also returned an empty result set.
I can see from the query:
SELECT * FROM [nt:unstructured] AS content
WHERE PATH(content) LIKE '/Content/%' // ISDECENDANTNODE(content, '/Content') works just as well
ORDER BY NAME(content)
...that the query otherwise works, and returns the expected result (all content). It just doesn't work when searching for the shared nodes.
How do I correctly search for shared nodes in JCR using ModeShape?
Update: I upgraded to 4.1.0.Final to see if that helped, but it had no effect on the described behaviour.
Cross-posted from the ModeShape forum:
Shared nodes are really just a single node that appears in multiple places within a workspace, so it's not exactly clear what it semantically means to get multiple query results for that one shareable node. Per Section 14.16 of the JSR-283 (JCR 2.0) specification implementations are free to include shareable nodes in query results at just one or at multiple/all of those locations.
ModeShape 2.x and 3.x always returned in query results only a single location of the shared nodes, as this was the behavior of the reference implementation and this was the feedback we got from users. When we were working on Modeshape 4.0, we tried to make it possible to return multiple results, but we ran into problems with the TCK and uncertainty about what this new expected behavior would be. Therefore, we backed off our goals and implemented query to return only one of the shared locations, as we did with 2.x and 3.x.
I may be wrong, but I'm not exactly sure if any JCR implementation returns multiple rows for a single shared node, but I may be wrong.

Play framework: Dynamic routing depending on version number

I'm trying to dynamically define a version in the URI routing.
My immidiate ideas were to
a)
I've configured in the application.conf a row stating my current version:
myApp.ver = 0.1
I wan't to use it in the routes file as part of the URI, for example:
GET /myApp/{version}/welcome controller.myApp.Welcome()
The idea is not to pass the version number to the Welcome() method
but to get the version from the application.conf file.
I've searched for defining parameters in the route file but didn't find information that helped me.
b) Another idea was to have a variable in the routes, something like:
CurrentVersion = 0.1
in the routes file and use it in the URI.
How can I solve this? I havn't found an example for this.
Thanks.
If you want to do this for every route, it should be possible to set the application.baseUrl to include your version number. To do this conveniently you can define the version in your application.conf instead of the Build.scala file, as described here.
myApp.name = myApp
myApp.ver = 0.1
application.baseUrl = ${myApp.name}/${myApp.ver}
If you want to do it only for some routes, there doesn't seem to be a simple solution. If you could ignore parameters in routes, I'd say use a regexp parameter and verify it in your global router - unfortunately this doesn't seem possible without passing the parameter to the controller.
So I see two other options:
Hardcode the version number in the routes file and do a search and replace every time it changes.
Create a plugin for the sbt build process and let it replace the version in your routes file.
In Play 1.2.x, in your conf/routes file, add a route like this:
GET /myApp/${play.configuration.getProperty("myApp.ver")}/welcome myApp.Welcome()