What is the workflow for using scssphp?

综合技术 Hello, buddy! (源链)

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.

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/
.

您可能感兴趣的

Agile in Action: Rolling Out Agile Workflow On The... When Arc first launched, the digital publishing platform had one client and full-time front end developer. Nine months later, two more developers join...
8 Best Practices for Perfect CSS Documentation In the world of CSS, documentation is underused. Since documentation is not visible to the end user, its value is often overlooked by clients. Also, ...
DOM系列:浏览器与DOM 最近回过头来在 学习JavaScript中的DOM知识 ,随着学习进度的向前推移,越发感觉DOM知识点较多。为了能更好的系统了解清楚DOM相关的知识,我打算重新将DOM的学习划入到 DOM系列 当中。那么今天将是这个系列的第一篇。你将了解到DOM是什么,为什么它有用,以及如何与将来在教程中...
New revolutionary approach for CSS styling with JS Farvekonfigurator :art: ��️ ��️ "farvekonfigurator" - from Danish - "conf...
Building a Real-time Chat App with Sails.js If you’re a developer who currently uses frameworks such as Django, Laravel or Rails, you’ve probably heard about Node.js. You might already be usi...
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » What is the workflow for using scssphp?



专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录