Jammit gem is expanding the path of font files - jammit

After running the jammit -c assets.yml -o assets command, Jammit goes through all of my CSS files and changes them around before concatenating everything. It, for some reason, expands the URL() path for all of my #font-face url paths to the absolute path of the file located on my computer. Is there any way to get this to say as an absolute path within the public directory?

I found out the problem. Turns out that the font files were not located in the public directory so jammit was making sure that the path exists outside of that.

Related

Supervisord - How to use command with space in file path

Using supervisord, I am unable to use a file path with a space in one of the directories. I am trying to use my iCloud Drive folder as the path to the file.
the path:
~/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py
my program supervisord.conf (non working. works when pointed to a new path without a space in the directory)
[program:modbot]
command=/Users/Jonathan/.virtualenvs/modbot/bin/python3.7 /Users/Jonathan/code/modbot/modbot.py
paths I've tired in supervisord.conf:
~/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py
~/Library/Mobile\ Documents/com~apple~CloudDocs/Code/modbot/modbot.py
~/Library/Mobile' 'Documents/com~apple~CloudDocs/Code/modbot/modbot.py
"~/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py"
~/Library/"Mobile Documents"/com~apple~CloudDocs/Code/modbot/modbot.py
After googling I even tried double escaping but nothing is working.
turns out I'm an idiot. supervisord doesn't use ~ so that was the problem, working code:
[program:modbot]
command=/Users/Jonathan/.virtualenvs/modbot/bin/python3.7 "/Users/Jonathan/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py"

knit Rmarkdown moderncv to pdf using makefile with sty file in subdirectory

I am using the moderncv class to create a CV in Rmarkdown. In order to make the cv reproducible out of the box I have included the .cls and .sty files in the root directory. However, in an effort to keep the root directory uncluttered I would prefer to keep all the moderncv related files in a subdirectory (assets/tex/). I am able to access the .cls file using a relative path in the yaml front matter, but I am not able to access the .sty files unless they are in the root directory.
Searching previous questions on stackoverflow I learned the following: (1) keeping .cls and .sty files in nested directories is not recommended. I understand this and would like to do it anyway so that other people can fork my project and be able to knit the cv without having to deal with finding their texmk folder. (2) the solution to my problem seems to involve setting the TEXINPUTS using a Makefile (see this thread and another thread)
I am not very good with Makefiles, but I have managed to get one working that will knit my .Rmd file to pdf without problems, so long as the .sty files are still in root. This is what it looks like currently:
PDF_FILE=my_cv.pdf
all : $(PDF_FILE)
echo All files are now up to date
clean :
rm -f $(PDF_FILE)
%.pdf : %.Rmd
Rscript -e 'rmarkdown::render("$<")'
My understanding is that I can set the TEXINPUTS using:
export TEXINPUTS=".:./assets/tex:"
Where "assets/tex" represents the subdirectory where the .sty files are located. I do not know how to incorporate the above code into my makefile so that the .sty files are recognized in the subdirectories and my .Rmd is knit to PDF. In its current state, I get the following error if I remove the .sty files from root and put then in the aforementioned subdirectory:
! LaTeX Error: Command \fax already defined.
Or name \end... illegal, see p.192 of the manual.
which I assume is occurring because the moderncv class needs---and cannot locate---the relevant .sty files.
You could try to define the environment variable in the make rule:
%.pdf : %.Rmd
export TEXINPUTS=".:./assets/tex:"
Rscript -e 'rmarkdown::render("$<")'
Or you could set the environment variable in a set-up chunk in your Rmd file:
```{r setup, include = FALSE}
Sys.setenv(TEXINPUTS=".:./assets/tex:")
```
Note: Not tested due to lack of minimal example.

Is it possible to have Compass generate both expanded and compressed CSS files?

So we've got a standard Compass CSS project, with the sass and css directories. As a scenario, let's say that the .scss file is called foo-all.scss.
Is it possible, via command line or config.rb or any other means, to have Compass generate both a foo-all.css file, using the "compressed" style, and also a foo-all-debug.css file using the "expanded" style?
It seems to me like Compass will refuse to generate a CSS file that doesn't have the exact same name as the .scss file, and that the most you can do is specify which directory the CSS file gets generated to.
On my MacOS X shell I've been able to generate two different css (production.css and development.css) from a original.scss sass file in this way
fc-iMac:sass fcalderan$ sass -t compact --watch original.scss:production.css &
sass -t expanded --watch original.scss:development.css
(I've used compact instead of compressed but the example is still valid)
Doing so, every time I make a change to original.scss I've got two updated css file in the same folder (with a different output style)
Of course if you have many scss files to watch, you could specify an entire directory to watch instead of a single file (see SASS documentation for further reference)
This seems like somewhat of a deficiency in Compass. Is this really an uncommon thing to do? Regardless, here's what I went with. Let's say that the folder structure is like this:
Rakefile
/foo
/resources
/css
/debug
/sass
foo-all.scss
And then in the Rakefile, to generate both compressed and expanded version, I do this:
Dir.chdir "foo/resources/sass" do
# Compile both expanded and compressed variations
debugdir = File.join(File.dirname(__FILE__), 'foo/resources/css/debug')
sh "compass compile --output-style compressed --force"
sh "compass compile --output-style expanded --force --css-dir #{debugdir}"
mv "../css/debug/foo-all.css", "../css/foo-all-debug.css"
end
In essence, I generate the compressed CSS file in a separate /debug directory, and then move it up to the /css directory, to preserve URL paths in the CSS file. The debudir shenanigans are necessary because Compass seems to require an absolute path when using the -css-dir switch (on Windows, anyway).

smarty relative links with in html templates?

how do we include style sheets from a template file in smarty?
ca we use a relative path or does it have to be n absolute path?
structure might look like
project
|-- library
|-- css
|-- style.css
|--template
|--index.tpl
|--template_c
in the index.tpl what would be the proper format to access style.css?
would it ../library/css/style.css? or
/project/library/css/style.css?
It depends on what you want to do.
If your goal is to have the browser access the css file, you need to specify the path relative to the document root. so, if your project lies within htdocs, it might be /project/library/css/style.css.
If your goal is to read the CSS within Smarty (say to inline it) you need to specify the absolute file path (e.g. /home/users/foo/project/library/css/style.css)
Accessing files relative to the current template file works with ./file and ../file - but only for {include} and {extends}. Everything else must either be absolute or relative to the CWD (current working directory) of the actually executed script.

RUBYLIB Environment Path

So currently I have included the following in my .bashrc file.
export RUBYLIB=/home/git/project/app/helpers
I am trying to run rspec with a spec that has
require 'output_helper'
This file is in the helpers directory. My question is that when I change the export line to:
export RUBYLIB=/home/git/project/
It no longer finds the helper file. I thought that ruby should search the entire path I supply, and not just the outermost directory supplied? Is this the correct way to think about it? And if not, how can I make it so RUBY will search through all subdirectories and their subdirectories, etc?
Thanks,
Robin
Similar to PATH, you need to explicitly name the directory under which to look for libraries. However, this will not include any child directories within, so you will need to list any child sub-directories as well, delimiting them with a colon.
For example:
export RUBYLIB=/home/git/project:/home/git/project/app/helpers
As buruzaemon mentions, Ruby does not search subdirectories, so you need to include all the directories you want in your search path. However, what you probably want to do is:
require 'app/helpers/output_helper'
This way you aren't depending on the RUBYLIB environment variable being set a certain way. When you're deploying code to production, or collaborating with others, these little dependencies can make for annoying debugging sessions.
Also as a side note, you can specify . as a search path, rather than using machine-specific absolute paths.

Resources