matthodan / jekyll-asset-pipeline

Powerful asset pipeline for Jekyll that collects, converts and compresses JavaScript and CSS assets
http://www.matthodan.com/2012/11/22/jekyll-asset-pipeline.html
MIT License
364 stars 31 forks source link

jekyll is infinitely compiling when running on docker #51

Open antoniom opened 6 years ago

antoniom commented 6 years ago

When running jekyll serve --watch from my machine, jekyll-asset-pipeline scans for any css_asset_tag which is then bundled/minified/processed accordingly to the specified configuration.

When running the same command over the jekyll docker container it enters an endless loop regenerating the same css/js files To reproduce the problem I have uploaded a default jekyll project, with jekyll-asset-pipeline as an extra dependency.

Steps to reproduce

You will see an endless loop of the following messages:

......
jekyll_1  |       Regenerating: 1 file(s) changed at 2018-07-20 15:25:29
jekyll_1  |                     .asset_pipeline/assets/global-126f86ef705d66b48241be588c246da1.css
jekyll_1  | Asset Pipeline: Processing 'css_asset_tag' manifest 'global'
jekyll_1  | Asset Pipeline: Saved 'global-126f86ef705d66b48241be588c246da1.css' to '/srv/jekyll/_site/assets'
jekyll_1  |                     ...done in 0.2914276 seconds.
jekyll_1  | 
jekyll_1  |       Regenerating: 1 file(s) changed at 2018-07-20 15:25:29
jekyll_1  |                     .asset_pipeline/assets/global-126f86ef705d66b48241be588c246da1.css
jekyll_1  | Asset Pipeline: Processing 'css_asset_tag' manifest 'global'
jekyll_1  | Asset Pipeline: Saved 'global-126f86ef705d66b48241be588c246da1.css' to '/srv/jekyll/_site/assets'
jekyll_1  |                     ...done in 0.2699366 seconds.
jekyll_1  | 
jekyll_1  |       Regenerating: 1 file(s) changed at 2018-07-20 15:25:30
jekyll_1  |                     .asset_pipeline/assets/global-126f86ef705d66b48241be588c246da1.css
jekyll_1  | Asset Pipeline: Processing 'css_asset_tag' manifest 'global'
jekyll_1  | Asset Pipeline: Saved 'global-126f86ef705d66b48241be588c246da1.css' to '/srv/jekyll/_site/assets'
jekyll_1  |                     ...done in 0.2881608 seconds.
jekyll_1  | 
jekyll_1  |       Regenerating: 1 file(s) changed at 2018-07-20 15:25:30
jekyll_1  |                     .asset_pipeline/assets/global-126f86ef705d66b48241be588c246da1.css
jekyll_1  | Asset Pipeline: Processing 'css_asset_tag' manifest 'global'
jekyll_1  | Asset Pipeline: Saved 'global-126f86ef705d66b48241be588c246da1.css' to '/srv/jekyll/_site/assets'
jekyll_1  |                     ...done in 0.2700728 seconds.
.....

Is there a bug, or misconfiguration which causes jekyll to regenerate again and again the same assets?

jmsalazar84 commented 6 years ago

I think that the problem is related to the watch excluded folders because this plugins is constantly creating and deleting the same folder .asset_pipeline into the root directory.

I'm not an expert but I think that "create/delete" events are detected by the watch job and produce the loop in this case.

I solve this behavior doing this change in my _config.yml asset_pipeline: staging_path: '_assets/pipeline'

Greetings :)

timstallmann commented 4 years ago

Hmm -- I'm having this same issue but the fix doesn't seem to work here, instead I get:

Regenerating: 1 file(s) changed at 2020-03-15 16:13:06
                     _assets/.asset_pipeline/assets/global-1e0a56903cab4cb35e3fa85b5435530c.css

Any other ideas?

Philzen commented 1 year ago

@jmsalazar84 didn't fix it for me also, as it seems (at least for me) the watcher does not care at all that the staging_folder is created in an excluded folder, thus still ends up in a regeneration loop.

Setting staging_folder to a folder outside the project directory finally worked for me, for instance:

asset_pipeline:
  staging_path: '../.asset-pipeline'

or

asset_pipeline:
  staging_path: '/tmp/.asset-pipeline'

both work fine. The latter of course will only work on a *nix-like system.

You might want to override this in your CI pipeline _config.yml where you only want to build once anyway and different permissions may prevent the asset pipeline from being executed otherwise.