ckeditor / ckeditor4-sdk

A set of software development tools for CKEditor 4 along with samples.
Other
18 stars 21 forks source link

Keep samples source DRY #126

Open mlewand opened 9 years ago

mlewand commented 9 years ago

Keep samples source DRY

Sample HTML

We should not require developers to put whole HTML content in the file.

We should limit it only to the sample content itself.

eg.

<h1>Abbreviation <small >(Custom Plugin with Dialog, Context Menu and ACF)</small> <a class="documentation" href="http://docs.ckeditor.com/#!/guide/plugin_sdk_sample_1">Documentation</a></h1>

<p>
    This sample demonstrates the <strong>Abbreviation</strong> plugin that was created in the
    <a href="http://docs.ckeditor.com/#!/guide/plugin_sdk_sample_1">Simple Plugin tutorial series</a>
    from the Plugin SDK section of the <a href="http://docs.ckeditor.com/#!/guide">CKEditor Developer's Guide</a>.
</p>

Meta Tags

I see that meta elements might be a concern. We should be able to specify meta tags at the begining.

html
<meta name="description" content="Abbreviation Plugin">
<meta name="keywords" content="ckeditor, editor, wysiwyg, plugin, plugins, addon, add-on, timestamp, sdk, custom, development, tutorial, example, sample">
<meta name="sdk-samples" content="Abbreviation plugin">

Title

Since we need also to provide a value for <title/> element, we might also provide a <title/> element along with meta tags, and it would be moved to <head/>.

Eventually we can use <meta name="title" content="foobar"/>, which would move foobar to <title/> element in head.

But I would stay with first proposition, because it's simpler.

Result

So at the end we would end up with a sample like:

<meta name="description" content="Abbreviation Plugin">
<meta name="keywords" content="ckeditor, editor, wysiwyg, plugin, plugins, addon, add-on, timestamp, sdk, custom, development, tutorial, example, sample">
<meta name="sdk-samples" content="Abbreviation plugin">
<title>Abbreviation Plugin</title>

<h1>Abbreviation <small >(Custom Plugin with Dialog, Context Menu and ACF)</small> <a class="documentation" href="http://docs.ckeditor.com/#!/guide/plugin_sdk_sample_1">Documentation</a></h1>

<p>
    This sample demonstrates the <strong>Abbreviation</strong> plugin that was created in the
    <a href="http://docs.ckeditor.com/#!/guide/plugin_sdk_sample_1">Simple Plugin tutorial series</a>
    from the Plugin SDK section of the <a href="http://docs.ckeditor.com/#!/guide">CKEditor Developer's Guide</a>.
</p>

That would make source files so much more readable IMHO.

wwalc commented 9 years ago

As discussed a few minutes ago with @mlewand, the proposed simplified structure makes sense, however we cannot proceed with it yet due to inconvenience that it would cause during the daily work on SDK.

Basically, what is the most important for us at this moment is the ability to change and quickly see the results of changes, without having to build SDK after each change, because this is a quite time consuming task. @mlewand pointed out that having a grunt watch task that is watching file changes and builds just a selected sample once it's modified would do the trick.

This is an interesting idea, however until we have all the necessary scripts that can do this, we shall continue working in the way we worked so far.