hanami/assets

Nested assets with preprocessing getting wrong extension

Closed this issue · 1 comments

Expected behavior

For a tree structure like:

| - my_assets/
|   - parent.css.scss
|   - nested/
|      - nested.css.scss

and a configuration file like:

require "hanami/assets"
require "sass"

Hanami::Assets.configure do
  sources << [
    "my_assets"
  ]
end

following output would be expected (omitting files with fingerprint):

- public/
-  assets/
-    parent.css
-    nested/
-      nested.css
- assets.json

Actual behavior

Instead, the following output is created:

- public/
-  assets/
-    parent.css
-    nested/
-      nested.css.scss # Notice the extension here.
- assets.json

Notice that the preprocessing happens, but the extension remains the same.

Steps to Reproduce the Problem

  1. git clone https://github.com/waiting-for-dev/hanami_assets_nested_extensions_bug
  2. cd hanami_assets_nested_extensions_bug
  3. bundle
  4. find my_assets -name "*"
  5. bundle exec hanami-assets -c config.rb
  6. find public -name "*"

@waiting-for-dev I'm sorry for taking so long to reply.

Using sassc fixes the problem:

diff --git a/Gemfile b/Gemfile
index 8a2b7f3..a51333b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,7 +2,5 @@
 
 source "https://rubygems.org"
 
-git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
-
-gem "hanami-assets", github: "hanami/assets"
-gem "sass"
+gem "hanami-assets"
+gem "sassc"
diff --git a/Gemfile.lock b/Gemfile.lock
index 8473072..e0ab8cb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,39 +1,28 @@
-GIT
-  remote: https://github.com/hanami/assets
-  revision: 7901909dbada49e75702a5b7a9d0eeb6cf7f412d
+GEM
+  remote: https://rubygems.org/
   specs:
-    hanami-assets (1.3.0)
+    concurrent-ruby (1.1.5)
+    ffi (1.11.1)
+    hanami-assets (1.3.3)
       hanami-helpers (~> 1.3)
       hanami-utils (~> 1.3)
       tilt (~> 2.0, >= 2.0.2)
-
-GEM
-  remote: https://rubygems.org/
-  specs:
-    concurrent-ruby (1.1.3)
-    ffi (1.9.25)
-    hanami-helpers (1.3.0)
+    hanami-helpers (1.3.1)
       hanami-utils (~> 1.3)
-    hanami-utils (1.3.0)
+    hanami-utils (1.3.4)
       concurrent-ruby (~> 1.0)
       transproc (~> 1.0)
-    rb-fsevent (0.10.3)
-    rb-inotify (0.9.10)
-      ffi (>= 0.5.0, < 2)
-    sass (3.7.2)
-      sass-listen (~> 4.0.0)
-    sass-listen (4.0.0)
-      rb-fsevent (~> 0.9, >= 0.9.4)
-      rb-inotify (~> 0.9, >= 0.9.7)
-    tilt (2.0.8)
-    transproc (1.0.2)
+    sassc (2.2.1)
+      ffi (~> 1.9)
+    tilt (2.0.10)
+    transproc (1.1.0)
 
 PLATFORMS
   ruby
 
 DEPENDENCIES
-  hanami-assets!
-  sass
+  hanami-assets
+  sassc
 
 BUNDLED WITH
-   1.17.1
+   1.17.3
diff --git a/config.rb b/config.rb
index 54fe34e..3d100ce 100644
--- a/config.rb
+++ b/config.rb
@@ -1,5 +1,4 @@
 require "hanami/assets"
-require "sass"
 
 Hanami::Assets.configure do
   compile true
$ bundle exec hanami-assets -c config.rb
$ find public -name "*"
public
public/assets
public/assets/nested-0baccbcb053b6a464e0181d37ca4be0a.css
public/assets/nested.css
public/assets/parent-57f6a433d5f89377185f6edd4446f67d.css
public/assets/parent.css
public/assets.json