Import SASS file from database instead of filesystem

后端 未结 2 899
攒了一身酷
攒了一身酷 2020-12-20 23:48

I don\'t have much experience with Ruby. I want to @import sass from database instead of filesystem. I did not find any examples online. How should I go about implementing t

2条回答
  •  春和景丽
    2020-12-21 00:23

    Out of the box, sass will only import local files (anything else is compiled into a CSS @import statement) but as the sass docs explain you can write your own custom importers by extending the Sass::Importers::Base class.

    This answer to another question gives an example of a custom HTTP importer. You could approach this in (at least) two ways: write a custom importer for your database or serve the sass file over HTTP from the database (via a simple PHP page or something)

提交回复
热议问题