Comments (10)
Hey @ReessKennedy, thanks for the feedback. I like the idea of creating a URL that can trigger the compile, like a webhook. That would especially come in handy if we added an option to only compile scss manually (along with adding a compile button to the dashboard).
Would anyone else be interested in this?
from wp-scss.
@dmbostan Sorry for the delay man. If you haven't figured it out, you can just open up the wp-scss.php file and then just wrap all the code with this
`if ($_GET['compress'] == 'scss') {
Plugin code goes here ... .
}`
Then whenever you want to update the .CSS you can just visit any page on site and add ?compress=scss. (Or you can change the trigger to any variable / keyword combo, for security.)
You'll no longer be able to see the plugin options page with this so you have to set those settings first.
You probably don't have to wrap the entire page with brackets but I didn't want to waste any time looking at what to hone in on and knew this would work just as good.
from wp-scss.
Agreed - it would be nice to be able to do this. I wonder if changing the 'Compiling mode' will do it.
from wp-scss.
+1 on this. I am going to try to code a solution like this tonight ... I want to keep the plugin inactive at all times and then just be able to manually click on a link or button to recompile the CSS after an update to the SCSS is made.
from wp-scss.
Okay. What I decided to do is just wrap all the code in "wp-scss.php" in a URL activated conditional.
Specifically, if ($_GET['compress'] == 'scss') { all code here }
This way you can just leave the plugin activated on your live site all the time but it won't load any of the SCSS plugin code unnecessarily for all your visitors. Then when you make some changes and want to view them you can just visit your homepage and append mysite.com/?compress=scss and it will activate the code and compile it.
It's a hack. And I did have to modify the plugin but it works and solved my issue.
from wp-scss.
@brrn Yep, it would be handy so it could be triggered like a webhook. Some deploy tools allow you to trigger a URL after deploying code if your hosting only supports FTP (not SSH) so being able to recompile the SCSS after a deploy would be useful.
from wp-scss.
@brrn hell, yeah! Any ETA on this ?
from wp-scss.
@ReessKennedy can you share the code if possible? I don't quite get it.
from wp-scss.
@ReessKennedy thanks! Will give it a try.
from wp-scss.
@ReessKennedy @dmbostan Here's how I got this working. Wanted to regenerate the stylesheets whenever I saved an SCSS file within the AceIDE editor. Took quite a bit of debugging to find the correct hooks, but it's actually incredibly simple in the end:
// functions.php - Integration between AceIDE save event and regenerating WP-SCSS files
function mx_compile_wpscss_on_aceide_save()
{
if ( (class_exists('AceIDE\Editor\IDE')) && (class_exists('Wp_Scss')) )
{
add_action('shutdown', 'wp_scss_needs_compiling');
}
}
add_action('wp_ajax_aceide_save_file', 'mx_compile_wpscss_on_aceide_save');
Really, all you need to do is pick a place to add the wp_scss_needs_compiling
function to the shutdown
hook, and it'll take care of the rest.
from wp-scss.
Related Issues (20)
- Configure plugin via define or json HOT 2
- CSS rule filter: invert() creates error message HOT 2
- Settings are not getting stored HOT 3
- Improving performance HOT 5
- Add a version to the compiled scss file
- Source Map Issue HOT 4
- File Permission Error, permission denied. Please make the cache directory writable. HOT 7
- Update scssphp to v1.10.0 HOT 2
- ":not()" is crashing Wordpress HOT 6
- Can not change colors HOT 2
- Conflicting with any kind of infinite scroll plugin. HOT 2
- Wrong path in header generated HOT 2
- Warning: Array to string conversion HOT 3
- Version 3.0 Crashed my entire site - (Resolved) HOT 33
- Error with 3.0 Update: Uncaught Error: Class "ScssPhp\ScssPhp\Block\MediaBlock" #630 HOT 4
- Looking for a new maintainer HOT 7
- What would a Premium version of WP-SCSS look like? HOT 2
- 4.0.2 causing error in commented out SCSS HOT 2
- PHP 8.2 Creation of dynamic property ... is deprecated HOT 2
- PHP Warning: No such file or directory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-scss.