Jekyll 覆盖 Compass 生成的输出文件夹和 CSS
我正在尝试将 Jekyll 与 Compass 一起使用。 我在一个命令行上运行 jekyll --auto
,在另一个命令行上运行 compass watch
。 SASS 文件位于 /stylesheets
中,并编译为 /_site/stylesheets
。 Jekyll 配置为忽略 /stylesheets
。
编译样式表一开始工作正常,但每次我更改一些使 Jekyll 重新生成站点的内容时,它都会覆盖整个 /_site
文件夹,并且 /_site/stylesheets
消失。 Compass 不会重新生成它,因为源 SASS 文件尚未更改。
还有其他方法可以将 Jekyll 与 Compass 一起使用吗? 我可以将 Jekyll 配置为不覆盖整个输出文件夹,而只覆盖更改的文件吗?
I am trying to use Jekyll together with Compass.
On one command line I'm running jekyll --auto
and in another one compass watch
.
The SASS files are located in /stylesheets
and are compiled into /_site/stylesheets
.
Jekyll is configured to ignore /stylesheets
.
Compiling the stylesheets works fine in the beginning, but everytime I change something that makes Jekyll regenerate the site, it overwrites the whole /_site
folder and /_site/stylesheets
is gone. Compass doesn't regenerate it since the source SASS files haven't changed.
Is there another way to use Jekyll together with Compass?
Can I configure Jekyll to not overwrite the complete output folder but just the files that changed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在使用 Jekyll &我的 github 页面的指南针。这里: https://github.com/ardianzzz/ardianzzz.github.com
简单,
我只是将生成的css文件夹放在根文件夹中。 Jekyll 将在
_site
文件夹中生成文件。正如您在我的存储库中看到的。
只是用下面的代码调用CSS
,英语不好,抱歉。 :)
Im using Jekyll & Compass for my github page. here: https://github.com/ardianzzz/ardianzzz.github.com
Simple,
I just put the generated css folder in the root folder. Jekyll will generate the file inside
_site
folder.As you can see in my repository.
Just call the CSS with the following code
bad english, sorry. :)
问题是 Jekyll 在运行时会废弃 _site 目录的所有内容。我解决这个问题的方法是使用 rake 进行部署,然后在我的 rakefile 中添加以下内容:
然后运行:
填充 jekyll 目录,然后将指南针文件放在上面。
一个更简洁的解决方案可能是让您的 compass -watch 进程(假设您正在运行)将指南针编译到projectdir/css。然后,当您运行 jekyll 时,它只会将该 css 目录直接拉入 _site/css 中,您就完成了,没有问题(请参阅下面的目录结构)。
如果你在 _site/css 中放入任何东西,然后运行 jekyll 后它就会被删除,所以你要么需要运行 compass,要么将 compass 文件放入根目录的 css 文件夹中,然后 jekyll 就会正确复制文件。
The issue is that Jekyll, when run, scraps all the contents of the _site directory. The way I got around this was to use rake for deployment, and then have the following in my rakefile:
I then just run:
Which populates the jekyll directory, and then puts the compass files over.
A neater solution might be to make your compass -watch process (assuming that is what you are running) compile the compass to projectdir/css. When you then run jekyll it will just pull that css directory directly into _site/css and you're done, no problems (see below for dir structure).
If you put anything in _site/css and then run jekyll after it will be removed, so you either need to run compass after, or put the compass files into the css folder in the root directory, and then jekyll will just copy the files correctly.