Skip to content

Dart API: Support custom importers #172

@ranquild

Description

@ranquild

In Dart ecosystem there are 2 primary build systems:

  1. https://pub.dartlang.org/packages/build
  2. https://pub.dartlang.org/packages/barback

As in the docs, It should be noted that you should never touch the file system directly. Go through the buildStep#readAsString and buildStep#writeAsString methods in order to read and write assets.. The main thing here is that build system creates graph of assets dependencies for incremental compilation and that's why directly using of file system is prohibited.

What I suggest is to add file system abstraction layer so there will be different implementation for direct file system access and access of assets in build system steps. This can be interface in sass package itself, or, better, you can use https://pub.dartlang.org/packages/file and accept FileSystem instance in compile method and use LocalFileSystem as default. This also eliminates need for compileString function because if someone needs to compile sass from source in memory MemoryFileSystem can be used for this.

If you don't have time for implementing this yourself just guide me in right direction and I will do this. This is very important for me because lack of this abstraction do not allow me to use this package in any of dart projects in my company. If abstraction will be introduced, I will publish packages like sass_build and sass_backback that can be used to directly embed sass in dart build systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DartIssues particular to the pure Dart distributionenhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions