Skip to content

split2 file is always empty #34

@marc-villanueva

Description

@marc-villanueva

We recently updated our application from the 0.2.0 release of the gem to the current master. Now our application_split2.css file is always empty even though it is well past the 4095 selector count. After a bit of debugging, this clause in splitter.rb:42 always evaluates to true for every rule in the file. Therefore, nothing is ever written to the split file.

if rule =~ /^\s*}$/
  current_media = nil
  # skip the line if the close bracket is the first rule for the new file
  next if first_hit
end

I wrote a simple test to verify:

def test_split_string_failure
    second_part = CssSplitter::Splitter.split_string(File.read('test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries.css'), 2)
  refute_empty second_part
end

Is anyone else seeing this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions