我可以配置 SASS 以使 scss 文件不在 Web 根目录中吗?
看起来 SASS 默认会暴露 scss 文件,我觉得这很令人讨厌。有没有办法配置 SASS 在不在 Web 根目录中的文件夹中查找 scss 文件,但将它们编译到 public/stylesheets 文件夹中?
It looks like SASS by default exposes scss files which I find rather obnoxious. Is there a way to configure SASS to look for scss files in a folder that's not in the web root but compile them into the public/stylesheets
folder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的!
如果您使用 Compass,那么您将拥有一个如下所示的文件 /config/compass.rb。在这里,我的 sass 文件位于 app/stylesheets 中,并保存在 tmp/stylesheets 中编译(以帮助 heroku 部署)
/config/compass.rb
Yes!
If you use Compass, then you'll have a file /config/compass.rb that'll look like the following. Here I have my sass files in app/stylesheets and saving compiled in tmp/stylesheets (to help with heroku deployments)
/config/compass.rb
老问题,但实际上很简单,您只需将目录传递给 sass 而不是像这样的特定 .scss ;
sass --watch /location/to/you/scss/:/location/to/your/css
然后对 scss 的任何更改都将保存到您的 css 目录中,并且它也将遵循与您的 scss 目录相同的结构。
Old question but it's actually simple to do, you just pass the directories through to sass instead of specific .scss like so;
sass --watch /location/to/you/scss/:/location/to/your/css
Then any changes to scss will be saved into your css directory and it will also follow the same structure of your scss directory.