#require paths resolving in Stylus - stylus

Is there any way to avoid the #require '../../../../xyz in Stylus? Will Stylus automatically look for the ancestor folders if I only #require 'xyz like node.js (with node_modules)

Yes, you should use --resolve-url option and add your assets folder to paths
Command line:
stylus --include <path>
Or use paths parameter for gulp-stylus or grunt-contrib-stylus

Related

.gitignore everything but .c and .h recursively

I would like to ignore everything in a certain folder and its subfolders, except for .c and .h files.
Yet locally, i need other files too. Do i have to have these files, which should not be tracked, in the git-repo before or after i add the .gitignore?
And how do i do this?:
#ignore all
*
#but:
!source/**/*.c
!source/**/*.h
This is my current solution, but it does not work. But i think this also relates to the point in time, where i have to add the files, that should be ignored, but need to be there locally?
EDIT:
The problem is, i got a copy of a project, that does all kinds of makefile magic and other things, i do not even know what kind of file-types and subfolders there are (i will only work in one folder of the massive project, so i don't think, that the gitignore needs to be so exclusive) ... and i can't just commit everything, because the "lib" has to be installed i think, so everybody needs to do this on his own ...
Ignoring * means ignore everything including top-level directories. After that git doesn't even look into subdirectories. To fix that unignore directories. Your entire .gitignore should look like this:
# Ignore all
*
# Unignore directories
!*/
# Unignore source code files
!source/**/*.c
!source/**/*.h
Another approach is to ignore everything but force-add necessary files with git add -f.
The problem is that the pattern
*
excludes all directories, too. According to the gitignore documentation,
It is not possible to re-include a file if a parent directory of that file is excluded.
To make this work, then, you'll need to use make sure that directories are not ignored. The gitignore pattern format does not provide a way to distinguish between directories and regular files, so you'll need to do that manually. One possibility would be to put a .gitignore file in each that directory that reincludes all its subdirectories, but it would be easier to just reinclude all directories. These can be matched (exclusively) with a pattern that ends with a '/':
!source/**/
Also, you are right when you say
But i think this also relates to the point in time, where i have to add the files, that should be ignored
in the sense that gitignore does not apply to files that are already tracked.

How to create ctags only for c and h files in code

I have a compiled code. If i try generation the tags using the 'usr/bin/ctags -R *', it will include all the c,h,object files etc. So it is taking lot of time and also memory. Could you please let me know how to generate tags only for c/h files.
Use the --languages parameter:
ctags --languages=C
You can use a .ctagsignore file to exclude any unwanted files from the generated tags.
The following is an example I use for my projects:
Contents of .ctagsignore:
bin
makefile
obj
tags
workspace.vim
And then generate tags with:
-ctags -R --exclude=#.ctagsignore
This ignores every file in the bin, and obj folder, the makefile, the (future) generated tags file, and the workspace.vim file in the project directory. It essentially works like a .gitignore file, so you can use the wildcard (*.o) notation - myfolder/*.o ignores all object files in $PROJ_DIR$/myfolder/
i would try 'man ctags' and read thru the options.
or you can use shell magic like:
ctags `find . -name "*.[ch]" -print`
or something like that

Svn ignore some files in a directory

I would like to ignore *.dll and *.xml under bin directory, but include everything else (*.dll.refresh). I tried the following ignore patterns but that didn't work:
bin/*.dll bin/*.xml
bin\*.dll bin\*.xml
I don't want to ignore all *.dll, and obviously need the bin folder checked in.
You should set svn:ignore property on bin directory itself. Here is a link to some documentaion.

Maven pom systemProperty path to file syntax

Have follwong chunk from pom.xml:
<systemProperty>
<name>axis2.config</name>
<value>file:${project.build.directory}/../../axis2.properties</value>
</systemProperty>
what does syntax for value tag mean?
/../ - is id cd .. and forwards to parent directory?
short: ../ means parent direcory
long version:
file: specifies, that the following
content should be interpreted as a
file path.
${project.build.directory} is a
variable which will be replaced by
the runtime with the actual project
build directory
/ are folder separators
.. means parent folder
axis2.properties is the name of the
properties file
if you want to display the path for debugging purposes you might want to have a look at this:
http://www.avajava.com/tutorials/lessons/how-do-i-display-the-value-of-a-pom-xml-element.html
or
maven ant echoproperties task
Yes, it's a relative path to the project build directory, and go upper (in parent) two times.
In other words: it's the parent directory of the directory that contain your project build directory ;)
Source: Maven Properties Guide

How do I work with spaces in my wix source path?

wxs file the File tag Source attribute; the path has a space in it.
<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="C:\Documents and Settings\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>
I get this error
candle.exe : error CNDL0103 : The system cannot find the file 'and' with type 'Source'.
I can't be sure that my paths won't have spaces in it. How do I support spaces in the Source path?
Try upgrading to the latest stable wix release. I tested this with Wix 3.0.5419.0 and file paths with spaces are accepted without errors.
On a related note: File elements should not contain absolute paths like in your example, because you would only be able to build the setup on a single developer's PC. Use paths relative to the location of the wxs file instead, like this:
<File Source="..\bin\foo.exe" />
Or make use of a variable that contains the location of the files like this:
<File Source="$(var.BinFolder)foo.exe" />
You can then pass the location of the bin folder by invoking candle like this:
candle.exe -dBinFolder=c:\someFolder\bin\ foo.wxs
edit: as shown by Rob in his own answer, you can also use the light.exe -b switch to specify one or more base directories where the files to install can be found.
#wcoenen provides one mechanism. However, I prefer to use the light.exe -b switch. Then your code can look like:
<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="SourceDir\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>
and your command-line to light.exe would have:
-b "C:\Documents and Settings\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator"
You can have multiple -b switches and greatly reduce the complexity of your Source attribute.
Also, the File/#Id and File/#Name can be left off if you are fine with them defaulting to the file name (in this case, "EDS_UserImport.xls").

Resources