doublesecretagency / craft-cpcss Goto Github PK
View Code? Open in Web Editor NEWControl Panel CSS plugin for Craft CMS
License: MIT License
Control Panel CSS plugin for Craft CMS
License: MIT License
how do I install the plugin?
Do I rename the folder?
I can not see the plugin in my settings
Hello Lindsey :)
Any chance to add support to edit more than 1 css files.
Table for settings will do whats needed
Hi there
Thanks for your help :)
Getting this error when installing craft with php craft setup.
$schemaVersion = $pluginRef->getProperty('schemaVersion')->getDefaultValue(); on line 1206 in craftcms/cms/src/migrations/Install.php always returns 1.0.0 but it expects 2.0.0 set in composer.
The default value of craft is 1.0.0 if there is no schemaVersion property set.
Adding the schemaVersion property in CpCSS.php fixes this.
/**
First off, thanks for writing the Control Panel CSS plugin. One thing I thought of was that it would be cool if you could define custom CSS on a per member group basis. Not sure what's involved technically with this but would be awesome for a number of things.
Hi Lindsey,
First, thanks for sharing this plugin, it's been easy to use for adding styles to the redactor formatting menu. Unfortunately, I have been having issues developing this site locally because the CP takes forever to load (5+ sec.) and I wasn't sure what the issue was until today as I started disabling plugins. I put together a short video [removed] to demonstrate what's going on. Essentially loading an external style sheet with a environment variable {baseUrl}
causes the slowest load times. If I move the styles into the database this speeds things up, but is still not desirable.
Potentially related to #16, but I can't seem to get the path to a front-end URL or template working when listed in the CSS File(s) field.
I currently have a custom plugin generating CSS custom variables, and using variables to output them to the main wrapper. I've moved this its own template which loads successfully and outputs the processed Twig variables, but this content is not included in the CP CSS.
CSS File(s) field value:
@web/styleGuide,@web/dist/css/redactor.css
The redactor.css file is working properly, but the /styleGuide content is not being included. Any ideas?
I am using Vite to compile my css, and the output is name.xxxxx.css
By allowing Twig in the field, I could use Andrew's Vite plugin and enter {{ craft.vite.entry('name.css') }}
which would grab the correct file path from the manifest.
Trying to install cp-css from the command line and getting the error "No plugin exists with the handle cp-css"
I have repeated the same steps for cp-js and it works as expected.
composer require doublesecretagency/craft-cpcss
./craft plugin/install cp-css
*** installing cp-css
*** failed to install cp-css: No plugin exists with the handle "cp-css".
composer require doublesecretagency/craft-cpjs
./craft plugin/install cp-js
*** installing cp-js
*** installed cp-js successfully (time: 0.034s)
CraftCMS: 3.5.13.2
PHP 7.4
Ubuntu: 20.04
For some reason the path to the external css file is not parsing {siteUrl}, but treating it as a string literal. {siteUrl} works in other parts of the CMS, so it's definitely not a site-wide setting. Any thoughts why this might not be working?
`Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doublesecretagency/craft-cpcss ^2.5 -> satisfiable by doublesecretagency/craft-cpcss[2.5.0].
- doublesecretagency/craft-cpcss 2.5.0 requires craftcms/cms ^4.0.0-beta -> satisfiable by craftcms/cms[4.0.0, 4.0.0-RC1, 4.0.0-RC2, 4.0.0-RC3, 4.0.0-beta.1, 4.0.0-beta.2, 4.0.0-beta.3, 4.0.0-beta.4, 4.0.0.1, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.5.1, 4.0.5.2, 4.0.6, 4.1.0, 4.1.0.1, 4.1.0.2, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.x-dev, 4.2.x-dev] but these conflict with your requirements or minimum-stability.
Installation failed, reverting ./composer.json to its original content.`
According to https://plugins.craftcms.com/cp-css it should be compatible with Craft 3 as well though...
This is a sweet plugin! It would be cool if there was an option to link to an external override.css file, instead of writing everything in the CP. Otherwise, it works exactly as expected.
Cheers!
CP CSS is installed in a site I've taken over, where the setting for CSS file contains:
@web/assets/css/cp.css
Using ./craft serve
, I get the following:
2021-11-11 21:12:29 [-][1765][-][warning][application] Can't bust cache of CP CSS, unable to load contents of http://localhost:8080/assets/css/cp.css
I can fix that by setting 'cacheBusting' => false
. The file exists, and if I disable cache busting, I can see it applied in the control panel. But I can't use the control panel because every screen takes 2 minutes to try to load that.
I'm guessing this is because the built-in PHP server is single-threaded, and it times out waiting for file_get_contents
to respond.
Isn't _addHash
just adding a querystring param? Does the file actually need to be loaded from its URL?
I'm spoiled by CSS preprocessors, would it be possible, if on save, there was an option to redirect you back to the editor screen. It would make debugging small header changes incredibly easy!
I use a hash in my css file name that changes when the content of the file has changed. It's a part of my building process to bust caches.
I'd be thankful if I could see a support of such hashes in the linked file setting. So, I'll be able to use something like cp.*.css where * could be anything.
How do I actually install this? Unzipped and put in Craft 2 plugins folder and nothing shows up.
So, for funsies, go ahead and place this within the "additional CSS" field...
#details-container {
flex: 0 0 200px;
width: 200px;
Doing so will cause the control panel to become completely inaccessible you'll hit your max memory limit pretty fast. Why? I have no idea. The settings are saved in the project config, so some weird parse or escaping issue could be the cause. I'm unsure, but it may be worth doing some sort of syntax checker before save.
To get the control to be unbroken you'll need to go into your projectconfig table in your database, find the row with the plugins.cp-css.settings.additionalCss
path, and clear it out to ""
. Then, you can run the ./craft clear-caches/all
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.