如何设置Gruntfile在heroku上使用指南针/ sass? [英] How to setup Gruntfile to use compass/sass on heroku?

查看:94
本文介绍了如何设置Gruntfile在heroku上使用指南针/ sass?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用 grunt buildpack 设置了我的heroku应用程序。当我将Node.js应用程序推送到heroku时,它将运行适当的grunt任务。



我想要使用'grunt-contrib-compass'包编译我的.scss文件。但是,这需要指南针的可执行文件,我不知道该怎么做。



我已经检查过heroku文档,并且看到了描述用ruby设置指南针的过期文档 ......但是我还没有看到有关使用Node.js设置它的最新文档。



有什么想法?

解决方案

但我终于设法让它工作。需要的是让Ruby与Node.js应用程序一起安装,以便安装适当的gem。 这个要点非常有用,并且或多或少地描述了我需要做的事情。



总之,这个过程是:
$ b $ ul

  • 创建文件 .buildpacks Gemfile Gemfile.lock ,其中包含以下内容:



  • .buildpacks

      https://github.com/heroku/heroku-buildpack-ruby.git 
    https://github.com/heroku/heroku-buildpack-nodejs.git

    Gemfile

      sourcehttp://rubygems.org
    gemsass

    Gemfile.lock

      GEM 
    remote:http://rubygems.org/
    规格:
    sass(3.4.5)

    平台
    红宝石

    相依
    sass

    nb。我只使用Sass,而不使用Compass,但我猜你需要做的所有操作只是将 gemcompass添加到Gemfile中,例如。 指南针(1.0.3)在Gemfile.lock下方的sass中。
    $ b


    • 在您的应用程序中添加多buildpack:



      heroku config:add BUILDPACK_URL = https://github.com/ddollar/heroku-buildpack -multi.git


    • 最后,将这些内容推送到Heroku,Ruby和Sass应与您的Node.js应用程序一起安装,允许您使用与sass相关的grunt任务。



    I've successfully set up my heroku app with the grunt buildpack. When I push my Node.js app to heroku it will run the appropriate grunt task.

    What I'd like is to use the 'grunt-contrib-compass' package to compile my .scss files. But that requires the compass executable and I don't know how to get that.

    I've checked the heroku documentation and have seen an outdated doc that describes setting up compass with ruby... but I haven't seen any recent documentation for setting it up with Node.js.

    Any ideas?

    解决方案

    This took a lot of figuring out, but I've finally managed to get it to work. What's needed is to get Ruby to install alongside your Node.js app, so you can install the appropriate gems. This gist was very helpful and more-or-less describes what I needed to do.

    In summary, the process was:

    • Create the files .buildpacks, Gemfile, and Gemfile.lock in the project directory, with the following contents:

    .buildpacks

    https://github.com/heroku/heroku-buildpack-ruby.git
    https://github.com/heroku/heroku-buildpack-nodejs.git
    

    Gemfile

    source "http://rubygems.org"
    gem "sass"
    

    Gemfile.lock

    GEM
      remote: http://rubygems.org/
      specs:
        sass (3.4.5)
    
    PLATFORMS
      ruby
    
    DEPENDENCIES
      sass
    

    nb. I'm only using Sass, not Compass, but I'm guessing all you'll need to do to get compass is just add gem "compass" to the Gemfile and, eg. compass (1.0.3) below sass in the Gemfile.lock.

    • Add a multi buildpack to your app:

      heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

    • Finally, push these out to Heroku, and Ruby and Sass should install alongside your Node.js app, allowing you to use sass-related grunt tasks.

    这篇关于如何设置Gruntfile在heroku上使用指南针/ sass?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆