ProjectEvergreen / greenwood

Greenwood is your full-stack workbench for the web, focused on supporting modern web standards and development to help you create your next project.
https://www.greenwoodjs.io
MIT License
94 stars 9 forks source link

feature/issue 1199 `url` references in CSS bundling #1211

Closed thescientist13 closed 2 months ago

thescientist13 commented 3 months ago

Related Issue

resolves #1199

Summary of Changes

  1. Support bundling url references in CSS files with hashed filenames
  2. Add test cases
  3. Update Styles and Assets docs

TODO

  1. [x] inline <style> scratch dir assets handling and test case
  2. [x] basePath support
  3. [x] bundle / hash filenames
  4. [x] docs
  5. [x] clean up console logs / refactoring

Questions

  1. [x] Is our resolution algorithm too naive to map back url references to assuming the root of the user's workspace when dealing with relative paths, e.g. ../? - I think it's fine for now, if it breaks later on a particular use case, we can improve it then with a clear reproduction
  2. [x] to the above point, what about if using CSS Modules, e.g. with { type: 'css' } - tracking in https://github.com/ProjectEvergreen/greenwood/issues/1227
    • as per #923 , which would get transformed into a JS object response presently..., does that mean everything would have to go into assets/?
  3. [x] rename assets/ to public/ for general asset copying (could lead to duplicate copies) - https://github.com/ProjectEvergreen/greenwood/issues/1219
    • would mean changing default greenwood config output build directory name