Skip to content

Keep Ruby version up to date and watch out for sourcemaps #7

Description

@jeroenptrs

Hey there. I've been able to set up tests for Sass-only projects thanks to this article, so thanks!
Along the way, I've stumbled across a few things that spawned build fails:

If you're using the latest version of Sass, make sure Ruby is using the latest version as well. Travis doesn't provide the latest version (2.4.1) of Ruby on standard, which prompted a build fail. I updated my .travis.yml like this:

script:
- "test/travis.rb"

language: ruby
rvm:
- 2.4.1
before_install:
- gem install sass
- chmod +x test/travis.rb

Also Sass now adds sourcemaps on default when you compile to a compressed css. In case of those silent class checks, that you mentioned at the end of your article, this will spawn a build fail again.
This is because the file isn't empty anymore but contains the sourcemap file's name in comments. To counter this, you have to add --sourcemap=none to avoid Sass from generating a sourcemap file.

The test ultimately becomes:

result = `sass test/silent.scss build.silent.css -t compressed --sourcemap=none`
raise result unless $?.to_i == 0
raise "When $use-silent-classes is set to true the module should not output any CSS" unless File.size('build.silent.css') == 0
puts "Silent sass compiled successfully"

Anyway, thanks again for the handy article. Hope my contribution can help someone out there as well!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions