What is the workflow for using scssphp?

shimizu

I'm trying to migrate my css over to scss for a PHP application, but I'm confused about the proper workflow for generating css files. I'm using scssphp, which is a compiler for scss written in PHP.

In all my pages, I use the following stylesheet: css/mycss.css. I've put the scss version of the stylesheet in css/scss/mycss.scss. When I make changes to the scss file, I compile it locally by entering into my browser:

localhost/mywebsite/style.php/mycss.scss

The style.php file is as follows:

require "vendor/leafo/scssphp/scss.inc.php";
$scss = new scssc();
$directory = "css/scss";
$server = new scss_server($directory,null,$scss);
$server->serve();

This compiles the scss file and writes it to the css/scss/scss_cache folder. The filename is some hash. Here is my resulting directory structure:

style.php
-css
 mycss.css
    -scss
     mycss.scss
        -scss_cache
         4edf7f7bf9238jdsk9281sjkj32.css

Now ideally, I would like for the compiler to overwrite the css/mycss.css file. Is there a way to do this, or what's a proper workflow for replacing the original css file with the newly compiled css? I could always just copy and paste every time, but that doesn't seem very efficient.

Jeremiah Winsley

scssphp is meant to be used to serve the stylesheets directly. But if you'd like to just use the compiler functionality, you can do that:

require "vendor/leafo/scssphp/scss.inc.php";
$scss = new scssc();

$scssIn = file_get_contents(__DIR__ . '/css/scss/mycss.scss');
$cssOut = $scss->compile($scssIn);
file_put_contents(__DIR__ . '/css/mycss.css', $cssOut);

See http://leafo.net/scssphp/.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

What is the workflow for using Selenium in Java?

ReactNative, What's the benefit of using expo bare workflow?

What is the workflow for compiling one file using rebar3?

What is a good workflow for Continuous Deployment to a VPS using Travis CI and Capistrano?

What is the suggested workflow when working on a Kubernetes cluster using Dask?

What is workflow of the React

What is a good Databricks workflow

What is the correct workflow for JWT?

Prisma: What's the workflow?

How can i import a scss file into another scss file using the scssphp compiler?

Implementing workflow using Spring

What are the pros and cons of using a trunk-based Vs feature-based workflow in Git?

What is the most efficient git workflow for using and staying up-to-date on shared scripts?

What is the workflow of Eclipse Project Clean

What is a reasonable OSGi development workflow?

What is the workflow to auto connect a remote

How to compile SCSS with scssphp

change scss variable with scssphp

JSON validation using github workflow

Using docker during the development workflow

Using nix in a continuous delivery workflow

Typescript workflow using GNU Make

Using a recursive function beside a workflow

Workflow for using command line R?

sending a mail using informatica workflow

Python based asynchronous workflow modules : What is difference between celery workflow and luigi workflow?

Using Windows Workflow Foundation in Windows Service for remote execution of workflow

Share workflow artifacts between workflow runs / github actions using the API

What is the purpose of Feature in Azure DevOps Agile workflow?

TOP Ranking

HotTag

Archive