Jekyll recompiles every page every time - jekyll

When I run jekyll to generate my site, it regenerates every page. How do I tell it to generate only pages which are new or have changed?
Alternatly, what am I doing to make Jekyll think it need to recreate every page?

Jekyll automatically regenerates the entire site each time it runs -- that's just how it works. However, I believe it will only regenerate changed files if you pass the flag:
--watch
as in:
jekyll build --watch
Note: Instead of jekyll build --watch, older versions of jekyll use jekyll --auto.

As mipadi said, Jekyll regenerates the entire site when compiling it. However, the --auto flag makes it compile the whole thing, always.
It does this because, as elithrar said, each post/page can depend on one another and, as it's all decided during compile time, it can't be generated on the fly like it would in WordPress or Tumblr. So, to avoid broken links, everything is regenerated.
This can be problematic on the long run. For example, very big sites (>1000 posts) report extremely long compiling times with LSI enabled, which was addressed with some configuration options lately. And there are other problems, i.e. if you're dealing with CSS/JS (or LESS, SASS, CoffeeScript, be my guest), why would you recreate the whole thing?
This is a recurring discussion on Jekyll's issue list, so if you guys can think of a good solution, please post it there.
But, sincerely? If your site is small enough, just let it regenerate everything. It's much simpler this way.

For speeding up local development you can use --limit_posts NUM to limit the number of posts to parse. This can lead to significant time saving for sites with a lot of posts.
See
https://jekyllrb.com/docs/configuration/#build-command-options

Related

Stuck with NopCommerce First Changes Not Showing up

Hello everyone and thank you for your time.
I am a developper, I have 1 year experience with C# and 3 with Java, but not with NopCommerce.
I downloaded NopCommerce 4.20 and imported it into my Visual Studio 2019.
Arranged some problems and finally run it and applied a Theme I bought.
But, when trying to start modifying the code, it does not take any effect.
I thought this could have relation with compilation problems (I already saw the Topic for the error on compile 'ClearPluginAssemblies' and 'SaveLocalesFolders'). So the only way to get rid of it was to disable the MSBuild of this little project (which is used to clean duplicated Plugin directories by NopCommerce itself).
I have a bunch of questions:
1. What do I need to do with ClearPluginAssemblies? Configure it so that it doesn't give me more problems anymore when running the WebApp? Or disabling it and deleting manually the Plugin folder, after every compile, but before Starting the Webapp 'Node.Web'?
Exactly, which folder should I delete on this case? (For me it's ok to do it manually, I am starting to touch NopCommerce in order to see wether my uncle Business could work or not).
If 'ClearPluginAssemblies' do not affect to the compilation process... What can I do to start modifying the code ? Changes don't take effect on the Local instance of the Online Shop I am running! (for example, I want to add an element in the product page)
Visual Studio does not Highlight the *.cshtml files, it opens them only with white text, so I think it isn't recognising properly? Do I really compile my changes? They don't show up...
I am doing refresh, clean, compile, all the stuff for webapps, but I can't even start programming...
For 4 hours, I followed the next Topics but I couldn't get to solve it:
https://github.com/nopSolutions/nopCommerce/issues/4116
https://www.nopcommerce.com/boards/topic/71353/420-fails-to-build-clearpluginassembliesproj
https://github.com/nopSolutions/nopCommerce/issues/2728
What I need in the End is Start Modifying the Code and Generating the different Views.
I think I can delete manually Repeated NopCommerce default plugins (but not My theme Plugins), or with a Batch, whatever.
Thank you very much in advance !!

How to build Chromium faster?

Following only the instructions here - https://www.chromium.org/developers/how-tos/get-the-code I have been able to successfully build and get a Chromium executable which I can then run.
So, I have been playing around with the code (adding new buttons to the browser etc.) for learning purposes. So each time I make a change (like adding a new button in the settings toolbar) and I use the ninja command to build it takes over 3 hours to finish before I can run the executable. It builds each and every file again I guess.
I have a decently powerful machine (i7, 8GB RAM) running 64-bit Ubuntu. Are there ways to speed up the builds? (At the moment, I have literally just followed the instructions in the above mentioned link and no other optimizations to speed it up.)
Thank you very very much!
If all you're doing is modifying a few files and rebuilding, ninja will only rebuild the objects that were affected by those files. When you run ninja -C ..., the console displays the number of targets that need to be built. If you're modifying only a few files, that should be ~2000 at the high end (modifying popular header files can touch lots of objects). Modifying a single .cpp would result in rebuilding just that object.
Of course, you still have to relink which can take a very long time. To make linking faster, try using a component build, which keeps everything in separate shared libraries rather than one big onw that needs to be relinked for any change. If you're using GN, add is_component_build=true to gn args out/${build_dir}. For GYP, see this page.
You can also peruse faster linux builds and see if any of those tips apply to you. Unfortunately, Chrome is a massive project so builds will naturally be long. However, once you've done the initial build, incremental builds should be on the order of minutes rather than hours.
Follow the recently updated instructions here:
https://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows_build_instructions.md#Faster-builds
In addition to using component builds you can disable nacl, use jumbo builds, turn off symbols for webcore, etc. Jumbo builds are still experimental at this point but they already help build times and they will gradually help more.
Full builds will always take a long time even with jumbo builds, but component builds should let incremental builds be quite fast in many cases.
For building on Linux, you can see how to build faster at: https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md#faster-builds
Most of them require add build argments. To edit build arguments, you can see GN build configuration at: https://www.chromium.org/developers/gn-build-configuration.
You can edit the build arguments on a build directory by:
$ gn args out/mybuild

Simple "server-side" HTML partials/templates/layouts?

I'm working with two students to produce a few HTML pages (a homepage and two secondary page layouts) that will later be implemented into a larger CMS.
I'd like to be able to abstract the shared HTML (head metadata, primary navigation, footer, etc.) into separate files so we only have to update them in a single place, execute a shell command to generate new, complete output. Since these pages are only ever going to become templates for another team, I don't even need to integrate any external data sources.
I know Jade would work for this but our partials/layouts/whatever need to look like HTML. I keep coming back to precompiling Handlebars templates but I'm not having much luck getting them to work.
Since we're using Foundation 5, Ruby and Node are already part of our toolchain. Suggestions?
I really like Middleman for this kind of thing. Layouts and partials and local data, etc. Wonderfully useful for doing front-end prototyping for what will eventually become a Rails application.

Can I generate content in Jekyll from two different directories

I have two pieces of somewhat unrelated source that I want to turn into one "site" using Jekyll. But they are in two directories. Let's say PROJECT/site/ has the homepage and copy and so forth, and PROJECT/clientlib/ has a bunch of libraries. I'd like, for example, PROJECT/site/index.md to become /index.html and PROJECT/clientlib/foo.js to become /clientlib/foo.js
This is an open source project so I'd really like to avoid fooling around with symlinks or submodules that might make it harder for someone to check the project out and start using it. And I want to be able to use the Jekyll dev server, without doing fixup on the generated files.
Is there a way to configure (or hack) Jekyll to get the layout I'm hoping for?
I just finished publishing a custom gem that accomplishes this. It lets you specify a shared_dir that can be used between multiple Jekyll configurations for a common base:
https://github.com/sumdog/jekyll-multisite
You can give them the same destination path in your _config.yaml file (in place of the default _site, see https://github.com/mojombo/jekyll/wiki/Configuration
e.g.
destination: ../_site
but you will overwrite filenames, etc if they are duplicated between the two.

With Rails, where should I put html snippets? I don't want partials but I want them reloaded during development

Being lazy (and liking DRY code), I'm the kind of guy who's going to write a few little wrappers for recurring HTML markup. Those provided by Rails are good already, but sometimes I have something a little more specific that I know I'm going to repeat over and over.
In some situations a partial can be the solution, but sometimes I'm just going to call the snippet way too often to justify the overhead of using partials.
Right now I create a helpers/html_helper.rb file and stick them in there. The problem is that helpers are not reloaded dynamically per request during development. So each time I tweak my snippet or the code around it, I have to kill the server and restart it.
Granted, it's just a 5 seconds process, but I love Rails' convenience of just developing and then refreshing the browser. So I'd love to have that for my markup snippets as well.
Note: Just sticking 'unloadable' inside the helper module doesn't work.
Good question! This is a technique I should abuse more frequently.
#I go in environment.db (presumably it will work in one of the per-environment files, too.)
Dependencies.explicitly_unloadable_constants << 'NameOfHelperToReloadHere'
That array starts out empty, incidentally, at least in my install. (Checked via console.)
I tested this locally and it works for me, at least on Rails 2.0.2. Major credit for the solution belongs to this gentleman.
If you stick them in application_helper.rb they'll be loaded every time and be available for all of your views. This is loaded every time in development mode (or at least I haven't encountered any issues).
I typically will create little helpers that I use throughout the site (sortable table headers for instance) that use the same logic.
This should reload ALL helpers on every request (assuming you've stuck to the default naming conventions)
#Put this in config/environments/development.rb
ActiveSupport::Dependencies.explicitly_unloadable_constants.concat(Dir.glob("#{RAILS_ROOT}/app/helpers/**/*.rb").map {|file| File.basename(file, '.rb').camelize})
Or if you are using an older version of Rails (2.0.2 or earlier I think)
#Put this in config/environments/development.rb
Dependencies.explicitly_unloadable_constants.concat(Dir.glob("#{RAILS_ROOT}/app/helpers/**/*.rb").map {|file| File.basename(file, '.rb').camelize})
Works for me in RoR 2.1.1
Update: modified top snippet to include 'ActiveSupport::', must have copied / pasted incorrectly from my code.
It's not a real solution but you could use tests (TestUnit, RSpec or whatever) to make sure your helpers work as expected. That way, you wouldn't rely on automatic reloading of your helpers so much.