Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor (example) Server class #2

robocoder opened this issue Jun 5, 2019 · 1 comment


None yet
1 participant
Copy link

commented Jun 5, 2019

Copied from: leafo/scssphp#333


  • the Server class is getting bloated
  • the Server class has too many public functions:
    • compileFile() - always recompiles
    • checkedCompile() - compiles scss if cache doesn't exist
    • checkCachedCompile() - recompiles if necessary
    • serve() - the original purpose of this class

Identified candidate cache implementations:

  • never - no caching; always (re)compiles
  • read - read only if cache exists; doesn't create
  • once - compiles only if cache doesn't exist
  • surface/shallow - recompile if main .scss file changes (note: this has no current API equivalent)
  • deep - recompile if main .scss file or any of its imports changes

Technical considerations:

  • bust up the Server class
  • Cache/*.php implementations
  • "deep" should detect changes in setVariables() and setImportPaths()

Other changes:

  • make Compiler cache aware (also, see existing importCache)
  • stale file detection using algorithm instead of metadata #321
  • parse tree cache #328
  • register custom error handler #330
  • register custom input finder #329
  • option to set/override or remove comment "compiled by scssphp..." #477
  • option to compress (gzip) output #483

This comment has been minimized.

Copy link
Member Author

commented Jun 18, 2019

Now that we have a new organization, we can also move the example Server class to its own repo (and package? e.g., scssphp/server)

That'll allow it to have its own composer.json and a dependency on scssphp/scssphp package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.