【问题标题】:Less not compiling automatically with powLess 不使用 pow 自动编译
【发布时间】:2012-07-31 01:28:50
【问题描述】:

我正在使用 Padrino 构建一个应用程序,并且我决定在样式表中使用较少的内容,主要是使用 twitter 引导程序。

在通过 pow 提供应用程序时,我无法自动编译我的 less 文件。

当我运行padrino start 并使用嵌入式服务器时,我得到了很好的样式,但我不太明白怎么做。生成的 application.css 文件正是它应该的样子,除了我的应用程序的公共目录中的 application.css 文件没有更改。

但是,当我通过 pow 运行应用程序时,对 application.less 文件所做的任何更改都不会反映在 application.css 文件中,这是唯一提供的文件。

我主要是想了解为什么只有在运行 webrick 时才会编译 less。

我的 less 初始化器是:

module LessInitializer
  def self.registered(app)
    # Enables support for Less template reloading for rack.
    # Store Less files by default within 'app/stylesheets/'
    # See http://github.com/kelredd/rack-less for more details.
    require 'rack/less'
    # optional - use as necessary
    Rack::Less.configure do |config|
      config.compress = true
      config.cache = true
      # other configs ...
    end
    app.use Rack::Less,
      :root      => Padrino.root,
      :source    => 'app/stylesheets',
      :public    => 'public',
      :hosted_at => 'stylesheets'

  end
end

而我的application.less 文件是:

@import "bootstrap/bootstrap.less";

body {
    padding-top: 60px;
    padding-bottom: 40px;
}

.sidebar-nav {
    padding: 9px 0;
}

【问题讨论】:

    标签: ruby less rack padrino rack-pow


    【解决方案1】:

    我刚刚用 Padrino edge 和 Pow 试过这个,它工作正常。

    说实话,无论是 Pow 还是 Webrick,它都不应该真正产生影响 - 只要它是机架投诉,它应该可以正常工作。

    您可以尝试将测试项目中的 padrino 的 gem 更改为指向:

    gem 'padrino', :git => 'git://github.com/padrino/padrino-framework.git'

    目前对于 less on edge 存在未满足的依赖关系,但它应该很快被合并。因此,如果上述方法不起作用,请使用:

    gem 'padrino', :git => 'git://github.com/padrino/padrino-framework.git', :branch => 'fix-less-dependencies'

    如果你一直有问题,你介意 Github 上的opening an issue 吗?

    谢谢!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 2016-04-09
      • 1970-01-01
      • 2012-08-29
      • 1970-01-01
      相关资源
      最近更新 更多