【问题标题】:Compass and SASS on complex project structureCompass 和 SASS 关于复杂项目结构
【发布时间】:2015-04-29 17:15:53
【问题描述】:

我正在开发一个 Angular 应用程序,我正在使用以下文件夹结构:

.
├── app
│   ├── assets
│   │   ├── images
│   │   │   ├── brands
│   │   │   ├── coletaSeletiva
│   │   │   ├── quiz
│   │   │   └── vidaEmLem
│   │   │       └── avatars
│   │   ├── sass
│   │   └── stylesheets
│   ├── scripts
│   │   └── controllers
│   └── views
│       └── coleta
└── test
    └── spec
        └── controllers

这是 yeoman angular 生成的项目。

从 SASS 生成的 css 指向具有以下路径 '/app/assets/...' 的文件,因为 config in 在项目的根目录中。

我的服务器从 app 文件夹开始,所以我只使用 /assets/... 调用我的资产

我该怎么办?

我应该将 config.rb 放在 app 文件夹中并更改资产路径吗?

我的 config.rb 看起来像这样:

http_path = "/"
css_dir = "app/assets/stylesheets"
sass_dir = "app/assets/sass"
images_dir = "app/assets/images"
javascripts_dir = "app/assets/javascripts"
relative_assets = true

【问题讨论】:

  • 那么您是否遇到了具体问题?还是您只是在寻找意见?
  • 每次我需要更改我的 css 文件,因为我的类使用的图像的路径是错误的。我想知道完成这项工作的最佳方法,因为我认为 config.rb 应该在我的根文件夹中,对吧?如果我正在管理我的应用程序,我应该调用应用程序根文件夹中的所有命令

标签: css angularjs compass-sass yeoman


【解决方案1】:

您可以使用“grunt”或“grunt --force”来缩小代码。那么我认为不会有任何问题。

如果您仍然遇到图像问题。尝试将路径设置为 ../images/image.png [如果图像文件夹在父文件夹中] 或 ./images/image.png [如果图像文件夹在同一文件夹中]。

【讨论】:

    猜你喜欢
    • 2013-09-10
    • 2012-08-08
    • 2018-02-17
    • 2020-06-28
    • 2011-06-22
    • 2016-10-21
    • 1970-01-01
    • 2013-03-18
    • 2016-04-15
    相关资源
    最近更新 更多