Skip to content

v3 - The simplification. #71

Merged
hswolff merged 36 commits intomasterfrom
v3
Mar 26, 2017
Merged

v3 - The simplification. #71
hswolff merged 36 commits intomasterfrom
v3

Conversation

@hswolff
Copy link
Copy Markdown
Member

@hswolff hswolff commented Feb 19, 2017

Thoughts on v3:

The overarching goals for V3 is to make Reptar simpler and easier to use.

Removing Plugins, Move to Middleware

Having an API requires maintaining the API, as well as learning how to use the API. It would be better to just use the Reptar instance directly, and any exposed objects and methods on the Reptar instance. This will remove the need to maintain an external API as well as help users of Reptar learn how Reptar itself works, as you'll be interacting directly with Reptar.

This means that plugins will be removed from the config.yml file.

You'll only be able to add middleware via a new local (to your project) reptar.js file. This will be considered a more advanced use case and as such will require usage of JavaScript. Sharing of middleware will continue to be done via NPM packages.

Question: When you run reptar build in your project, if it finds the presence of the reptar.js file it will use that to configure middleware. What should it do with that file? Look for an exported configure function to call to allow you to configure reptar as you want? I still want to support the rest of the Reptar CLI tools, so there needs to be some way to configure Reptar without replacing it.

// reptar.js

const excerptMiddleware = require('reptar-middleware-excerpt');

exports.configure = function(reptarInstance) {
  // Shared middleware.
  reptarInstance.use(excerptMiddleware);

  reptarInstance.use(function middlewareFunction(destination, reptar) {
    // Do what you want, custom middleware.
  });

  reptarInstance.config.set(newConfigFile);

  // Or whatever else.
}

Remove Collections as a built-in type, have it be a built-in middleware

This is to further emphasize the simplicity of Reptar. Reptar is comprised of utility functions, which help with reading files from the disk and rendering Markdown to HTML and then writing back to disk.

That being the case the collectionsMiddleware will just ingest all the Markdown files in your site and then use them to create Collections and CollectionPages.

I have this mostly working locally already. External API should remain the same but this is a step towards being more easily de-coupled from Reptar core.

Data files will also be moved as a built-in middleware

This is even simpler to do and will be done just for organization sake.

Remove and rewrite current 1st-part plugins to be middleware

This is namely

  • reptar-excerpt
  • reptar-html-minifier

Question with reptar-html-minifier: This is done after files are rendered. So perhaps there should be support for afterWare - code that runs after Reptar is done running.

// reptar.js

exports.configure = function(reptarInstance) {
  reptarInstance.useAfter(function afterWareFunction(destination, reptar) {
    // Do what you want, custom middleware.
  });
}

Rethink Themes

My main problem with how themes work right now is that all they're truly concerned with is defining how to process JavaScript and LESS/SASS files. This leads me to believe that Themes aren't really necessary. What we need to have is someway to define how to process JavaScript/LESS/SASS (asset files).

I'm not sure what that looks like yet but ideally Reptar can understand any .js file in your site and know how to process it. Perhaps it can be as simple as that, process every JS/LESS/SASS file and just copy it over to your destination site.

I was worried about a whitelist or blacklist on which files to include or exclude for processing however it's probably safe to process every file. It doesn't mean that every file will be included in your site. So you can have one main.js and one main.less that includes other files, and only that file will be included in your template file.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 19, 2017

Coverage Status

Coverage increased (+0.1%) to 89.378% when pulling 0ea5d6a on v3 into 2b3683d on master.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 21, 2017

Coverage Status

Coverage decreased (-0.3%) to 89.031% when pulling aa5ef4b on v3 into 9229ebf on master.

@hswolff hswolff force-pushed the v3 branch 2 times, most recently from b99dc35 to 5d3fca1 Compare March 19, 2017 22:46
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 19, 2017

Coverage Status

Coverage decreased (-1.7%) to 87.534% when pulling 5d3fca1 on v3 into 453d642 on master.

@hswolff hswolff force-pushed the v3 branch 2 times, most recently from ebaabd4 to 6547f4a Compare March 19, 2017 23:09
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 19, 2017

Coverage Status

Coverage decreased (-1.7%) to 87.534% when pulling ebaabd4 on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 19, 2017

Coverage Status

Coverage decreased (-1.7%) to 87.534% when pulling 6547f4a on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.05%) to 88.227% when pulling 9595ee2 on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.9%) to 88.338% when pulling 88df54e on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.0%) to 88.306% when pulling e6e85f9 on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.0%) to 88.306% when pulling e6e85f9 on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.04%) to 88.244% when pulling c319b1d on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.04%) to 88.244% when pulling a891d5b on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.08%) to 88.199% when pulling 7217a09 on v3 into 453d642 on master.

hswolff added 11 commits March 25, 2017 12:27
Create destination object that holds a representation of your site.
Make DataFiles a default middleware.

BREAKING CHANGE: Remove plugins and move to middleware system for extensibility.
BREAKING CHANGE: Using _config.yml is no longer used. You must now use
reptar.config.js in place of _config.yml. The main export needs to either
be an object which is your config or a function that has to return
your config object.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.08%) to 88.199% when pulling 17bd2b6 on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.08%) to 88.199% when pulling f394c8f on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.08%) to 88.199% when pulling 933e004 on v3 into 453d642 on master.

BREKAING CHANGE: All keys in your reptar.config.js have been updated to
use camelCase. The keys that must be changed are:

url_key -> urlKey
date_format -> dateFormat
future_date -> futureDate
page_size -> pageSize
clean_destination -> cleanDestination
new_file_permalink -> newFilePermalink.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.08%) to 88.199% when pulling ee871a1 on v3 into 453d642 on master.

@hswolff hswolff changed the title WIP: v3 - The simplification. v3 - The simplification. Mar 25, 2017
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.08%) to 88.199% when pulling b84dcdb on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.0%) to 88.308% when pulling 189bf7b on v3 into 453d642 on master.

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 26, 2017

Coverage Status

Coverage decreased (-1.7%) to 87.534% when pulling 768ab7a on v3 into 453d642 on master.

@hswolff hswolff merged commit c47c2c3 into master Mar 26, 2017
@hswolff hswolff deleted the v3 branch March 26, 2017 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants