dart-league / dart-sass

Sass-transformer for pub-serve and pub-build
MIT License
12 stars 8 forks source link

Dart package support changes may require update #1

Open bwilkerson opened 8 years ago

bwilkerson commented 8 years ago

I don't fully understand the issues, but a comment (https://github.com/dart-lang/sdk/issues/24812#issuecomment-157130923) in the Dart sdk repository indicates that the removal of the packages directory might cause problems for this transformer. Additional background is available in the follow-up comment (https://github.com/dart-lang/sdk/issues/24812#issuecomment-157135212).

MikeMitterer commented 8 years ago

Not the transformer - every EXTERNAL tool relaying on packages. E.g. SASS If a package exposes some SCSS files for other packages then there is no way for SASS to compile these files to CSS.

This package: https://github.com/MikeMitterer/dart-material-design-lite/tree/master/lib/assets/styles exposes some SCC-Files.

With the packages folder I can include the mdl-package in a project and then on the cmdline I can say:

scss packages/mdl/assets/styles/material-design-lite.scss test.css 

but what would be the solution without the packages-folder? OK - this would work:

scss "/Users/mikemitterer/.pub-cache/hosted/pub.dartlang.org/mdl-1.9.0/lib/assets/styles/material-design-lite.scss" test.css

but would also be very cumbersome furthermore this solution relays on a specific version.

komu commented 8 years ago

It seems that the solution would be far from trivial: we'd need to Ruby code that installs a custom importer, which calls back to our Dart code and then calls Barback's API. Furthermore, we also support sassc and I don't think it's possible to use custom importers in those cases. (As far as I understand, libsass does support them, but then we'd need to provide platform specific libraries.)

I understand the rationale for changes in pub and sympathize with the problem, but unfortunately I haven't really used Dart (and dart-sass) for anything in a while and I don't see that changing in the near future. So I don't think I'll be able to find time to work on this.

I'd be happy to take pull requests and I'd be willing to pass the project to a more active maintainer as well.

kevmoo commented 8 years ago

FYI: while we will evolve our package story, we are planning to support this via the Resource package – https://pub.dartlang.org/packages/resource – there won't be any changes to the creation of package directories until Dart 1.15 at the earliest

MikeMitterer commented 8 years ago

@kevmoo What will this resource-package be or do? Does it somehow export resources from the lib?

I attached a SS just to show what I'm doing at the moment. As you can see I use for example the variables.scss from my mdl-library to make some settings in a library that uses the mdl-package. This works just fine.

Wouldn't it be an option just to export resources from a package? Something like this: pubspec.yaml:

name: package_test
...
export:
    lib\assets

which leads to: (after pub get) <my Package>/web/resources/package_test/...

SS: screenshot-1938

kevmoo commented 8 years ago

@MikeMitterer we plan to keep the model where anything you want to access from another package must be in the lib dir – it keeps our model very simple.

jacehensley-wf commented 8 years ago

Has there been any update on this? It would be really nice to start using the --no-packages-dir flag now that Dart 1.19.0 has been released.