I'm using jekyll build --watch to automatically regenerate _site folder when I make changes.
I also have a script that resolve CDN url in the _site directory. But I have to run that script manually every time Jekyll regenerate the content.
How can I set option on Jekyll to execute my CDN resolve bash script automatically after regenerate _site folder ?
I'd suggest adding Gulp to your Jekyll workflow, to accomplish this... a simple google search for jekyll gulp will lead you down to many tutorials on how to achieve this.
Related
I have a github pages site using the jekyll cayman theme, and I set up a sass stylesheet at assets/css/style.scss
Its contents begin:
---
# Front matter comment to ensure Jekyll properly reads file.
---
//DON'T DELETE THE ABOVE
#import "jekyll-theme-cayman";
and then I have the rest of my sass.
I then run bundle exec jekyll serve.
This used to work to start a server, and watch changes to the sass file and compile them to _site/assets/css/style.css.
I can see that it is picking up that there are changes in the sass file - the console logs: Regenerating: 1 file(s) changed at 2022-10-28 21:22:54 assets/css/style.scss - but nothing gets output to the style.css file. I've tried running bundle exec jekyll serve --watch.
That no longer works, and I'm not sure why. I noticed when I tried to run this for the first time in a while, it complained about nokogiri, so I ran bundle install - maybe that messed things up?
Try bundle exec jekyll clean && bundle exec jekyll serve or one command after the other. Clean removes files and cleans Sass and Jekyll caches. See https://jekyllrb.com/docs/usage/
I've spent about a day trying to figure this out.
What I finally did was a bash script:
gw() {
# runs grunt using this path
cd ~/root_install/grunt
grunt watch &
cd ~/root
}
My install file are in root_install and my source file are in root.
Note installing the grunt task runner globally is deprecated.
Note that setting the location of the Gruntfile.js does not work as it appears to need a local installation of the task runner.
This seems to be the deal killer.
But alas, application files I want separate from my source files and Grunt is an application.
What I have works, but it is a bit hackish as I don't want to spend any more time on this.
I've been trying to setup SASS (and Bourbon.io) with jekyll for a personal blog on github pages.
I've changed the name of the css folder that is installed with jekyll to stylesheets and within stylesheets I have two folders, css and sass.
I start my jekyll server locally with: jekyll serve --watch
Then in another terminal window: sass --watch stylesheets/sass:stylesheets/css
But I am now getting the following message:
`/' not found.
Prior to attempting to setup SASS with my jekyll project, my site was displaying. Any links for setting up sass with jekyll would be helpful. Thanks.
New in Jekyll 2.0 is native processing of Sass and CoffeeScript:
http://jekyllrb.com/docs/assets/#sassscss
hope not being to late, for what you are pretending there are many approaches for example i use bourbon, neat in a jekyll project and use grunt tasks for local development.
Another option is to use a rakefile with some task to handle both programs (jekyll and sass) or as favrizio suggested use jekyll's pluging.
I reccomend you to take a look to grunt.
This happens usually if you have messed with the site baseurl in the _config.xml and it can no longer resolve itself to find the index.html.
I'm pretty new to SASS/SCSS and got a git project with CSS Files in the main directory which shall import partials from a subdirectory. I was wondering if it's possible to install sass on the server, create a compass project so that css files will be created automatically after a live edit of the scss files on the server? Or does it have to be local with a filewatcher? I already tried to set up a compass project on the server but no css files were created automatically. Was it because of wrong settings or is it just not possible this way?
If it's possible is there a good step by step tutorial? I already found this
Maybe the problem is the path. In my config.rb I changed the path without knowing what to write in the string if sass and css directory are the same as project path. Didn't work with "/" or an empty string.
Both Sass and Compass provide watch commands. You can use either:
sass --watch input.scss:output.css (options)
or, assuming you've got your Compass config file correctly setting your css_dir vairable:
compass watch
Either of those should recompile the css file upon changes. If you want this done live on the server, you'll need to execute the watch command on the server.
To add a point to #aerook's answer,
In your projects you may have multiple scss and css files. In which case you may use the following to watch the entire scss directory to make changes in the css directory
sass --watch scss:css
PS : scss and css are folder names in the same directory path.
I'm using Jekyll to create a new site. I'm using the command jekyll serve --watch to automatically rebuild the site each time a change is made.
This is working great so long as I make a change to an existing file. However, if I add a new folder, Jekyll does not notice it. I have stop Jekyll from watching, then restart it for it to notice the new folder and include it in my _site directory.
Is this expected behaviour or is there likely a problem with my setup?
The same thing happens with my Jekyll. I believe the jekyll serve --watch command looks in the current directories for changes, not newly created ones.