-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: Add support to create and build skins | Issue #66 #65
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach seems reasonable to me. My only question:
Add support to create and build custom skins
How many of these are we planning on making?
Probably we want to include this as part of the entire build process
Yes, and I imagine, commit the resulting skin files to the repo as well?
ck.sh
Outdated
@@ -85,6 +85,53 @@ case "$COMMAND" in | |||
esac | |||
;; | |||
|
|||
buildskin) | |||
cd skins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will blow up if you run it before running createskin
for the first time.
Rather than mkdir -p skins
below, we could just create that directly in the repo and commit it (ie. empty dir with a .gitignore
in it so that Git can actually track it) — once we have a skin in here we can remove the .gitignore
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha
ck.sh
Outdated
|
||
select skin in * | ||
do | ||
echo "you selected $skin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, if I select a bogus entry, $skin
will be an unset or an empty string which means that we'll ed up running:
java -jar dev/builder/ckbuilder/2.3.2/ckbuilder.jar --build-skin ../skins/ ../ckeditor/skins/
So we probably need a check for valid input before proceeding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but here we're selecting a skin from a list, how a bogus entry could be selected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
said nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can type random crap in, as you've probably discovered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep xD
ck.sh
Outdated
createskin) | ||
read -r -p "What is the name of the new skin? " skinName | ||
|
||
echo "Which skin do you want to use as base?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to offer this much flexibility? Won't we be building exactly one skin from one base? If this is not something that we are going to do often, then we might be able to simplify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we don't need it, I need to keep working on not doing more than we need 😅 I'll get rid of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To help you, you can print these out and sleep with them under your pillow:
- https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
- https://martinfowler.com/bliki/Yagni.html
- https://wiki.c2.com/?YouArentGonnaNeedIt
Alternatively, you could read them. Another option is starting on wiki.c2.com and spending the next 10 hours following links. 😂
ck.sh
Outdated
mkdir -p skins | ||
|
||
# Create folder for the new skin | ||
mkdir skins/"$skinName" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in part what -p
is for. Rather than invoking mkdir
twice:
-p Create intermediate directories as required. If this option is not specified,
the full path prefix of each operand must already exist. On the other hand,
with this option specified, no error will be reported if a directory given as an
operand already exists. Intermediate directories are created with permission
bits of rwxrwxrwx (0777) as modified by the current umask, plus write and search
permission for the owner.
@wincent pr updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. You should probably also update the usage()
function in the script, and the README also describes what the subcommands are for and how to use them, so should probably update that too.
ck.sh
Outdated
do | ||
if [[ $skin = "" ]]; then | ||
echo "selected skin doesn't exist" | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No semis.
Oooki doki |
@wincent anything else? :P |
@carloslancha I know this is not automated yet, but I'd suggest running shellcheck on the script just to see if there are any errors - if @wincent thinks it's also a good idea |
While trying to build ckeditor to test the new skin I discovered that the skins has to be placed in |
This is what I was getting at with this comment:
Integration testing for the win! |
It's already there, so leave it. Once the skin is in there, once we can see that it's all working and we don't have to redo things, then we can look at cleaning it up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two miniscule nits noted inline, but you should feel free to merge this.
README.md
Outdated
|
||
1. Create a new skin running `sh ck.sh createskin`. | ||
2. Edit the skin at `/skins/yourskin` folder. | ||
3. Build the sking running `sh ck.sh buildskin`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sking -> skin
ck.sh
Outdated
@@ -2,6 +2,8 @@ | |||
|
|||
set -e | |||
|
|||
CKBUILDER_VERSION="2.3.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to do nothing.
This pr is, of course, WIP, but I need your feedback to see if this is the right direction (or the one we which we want to go). #66
Purpose of the PR:
Add support to create and build custom skins so we don't need to place all the custom styling in portal, plus we need to change some icons and that only can be done via custom skins.
Creating skins
CKEditor recommends to use one of their base skins to create custom skins so the idea is to be able to choose which one we want to use on the creation moment.
The creation process is pretty simple, we just select the base skin, copy it to our
skins
folder with the new given name and replace the old name with the new one inside all the files.Building skins
Following CKEditor docs we need to use their
ckbuilder
to build the skin (the java one, there's no support for skins on the .sh, maybe we can send them a pr to add it).For now I just added a script to build the selected skin and place the result inside the
ckeditor
dist folder. Probably we want to include this as part of the entire build process, but I need some conversation here so we can find the best way to proceed.