irundaia / sbt-sassify

sbt-web plugin for Sass files
Apache License 2.0
68 stars 17 forks source link

Allow execution within the Asset Pipeline #19

Open driverpt opened 7 years ago

driverpt commented 7 years ago

e.g.: pipelineStages := Seq(sassify, filter, digest, gzip)

So that filter can filter out .scss files from the result.

irundaia commented 7 years ago

I'm not sure that the conversion to a pipeline plugin is necessary. I think sbt-filter will only perform its filtering when a production build is triggered. I'll try to find some time to look at this this evening.

driverpt commented 7 years ago

@irundaia , the purpose would be to have something similar to sprockets. To process the Resources as a whole and be able to output 1 or more minified javascript and stylesheets file.

irundaia commented 7 years ago

@driverpt, I fail to see how this is impossible with the current approach. If sbt-filter removes the .scss/.sass files, you can set up your final assests the way you want. If you want to have 1 minified file, that's up to you...

Also from the sbt-web README.md:

Source file tasks can be considered to provide files for the first stage of asset pipeline processing and they will be executed often e.g. for each compilation of your project's source files. Asset pipeline tasks are generally executed at the time that you wish to prepare a distribution for deployment into, say, production.

So if I understand this correctly, first source tasks are run. The output thereof, can then be used as desired in the filtering pipeline

I might be understanding this incorrectly... Could you perhaps give a an example of how you'd want your input files to flow through your pipeline?

driverpt commented 7 years ago

I want for example pipelineStages:= Seq(uglify, concat, gzip, digest) and i want to output 2 .js files (main code and libs) and 1 single stylesheet file.

When i developed an app in Grails, i used this, which has a similar sprockets behaviour.

e.g.:

stylesheets
└ foo.scss
└ bar.scss
javascripts
└ baz.coffee
└ plugins
     └ lib1.js
     └ lib2.js

And the output to be

stylesheets
└ styles-<digest>.css
javascripts
└ main-<digest>.min.js
└ libs-<digest>.min.js

Any ideas how to achieve this ?