github MoOx/phenomic 0.16.0

latest releases: v1.0.0, v1.0.0-beta.11, v1.0.0-beta.10...
7 years ago

tl;dr

  • πŸ”¨ Breaking change: "phenomic/lib/content-loader" should now be replaced
    by a value imported from "phenomic"
    (import { phenomicLoader } from "phenomic").
    Following this, phenomic loader configuration should be directly in
    phenomic section, not phenomic.loader or phenomic.contentLoader.
  • πŸŽ‰ New feature: dynamic pages! You now have the ability to generate
    pages for all metadata used in your text files.

    This can be used to generate pages for tags, categories, authors etc.
    (Pagination is not handled yet, but will be in a near future).
  • πŸŽ‰ New feature: phenomic loader now supports plugins.
    Lots of flexibility has been added with this feature,
    unlocking a lot of possibilities!

πŸš€ Examples of update and changes:

ℹ️ Some works has been done on the documentation:

Details

  • Changed: default markdown renderer updated to
    remark-autolink-headings@^4.0.0.
    This might fix issue with missing links for headings.

  • Changed: default markdown renderer updated to
    remark-highlight.js@^4.0.0
    This might fix issue with broken highlighted code.

  • Changed: phenomic/lib/content-loader reference is deprecated in favor of
    import { phenomicLoader } from "phenomic".
    You can use phenomicLoader variable in webpack configuration to reference
    Phenomic loader. This change allows us more flexibility for the location of
    the code.
    (@MoOx)

  • Changed: loader will now read loader configuration directly from phenomic
    section, not in phenomic.loader or phenomic.contentLoader

  • Removed: renderer option from content-loader (now phenomicLoader).
    See the new plugins option below for more information.
    If you want to do the same effect, you can use the following plugins

    import { phenomicLoader, phenomicLoaderPlugins } from "phenomic"
    
    // ...
      phenomic: {
        // ...
        plugins: [
          // this 3 default plugin can be replaced by the a preset. More info below
          phenomicLoaderPlugins.initHeadPropertyFromConfig
          phenomicLoaderPlugins.initHeadPropertyFromContent
          phenomicLoaderPlugins.initBodyPropertyFromContent
    
          phenomicLoaderPlugins.markdownInitHeadDescriptionPropertyFromContent // optional, now you can replace this if you don't use markdown!
          // phenomicLoaderPlugins.markdownTransformBodyPropertyToHtml
          // the commented plugin above is the default renderer
          // here is an example that can be used like the old renderer
          // method
          ({ result }) => {
            // the difference here, is you need to return the entire new
            // (modified) result.
            // The `body` part is what your are looking for
            return {
              ...result,
              body: doYourThing(result.body),
            }
          }
        ]
      }
  • Removed: raw and rawBody properties from page data.
    If you want those back, there are plugins ready for you:

    import {
      phenomicLoader,
      phenomicLoaderPlugins,
      phenomicLoaderPresets,
    } from "phenomic"
    
    // ...then in the webpack config
    
      phenomic: {
        plugins: [
          ...phenomicLoaderPresets.default,
          ...phenomicLoaderPresets.markdown,
          phenomicLoaderPlugins.initRawPropertyFromContent,
          phenomicLoaderPlugins.initRawBodyPropertyFromContent,
        ]
      }

    See the new plugins option below for more information.
    (#547 - @MoOx)

  • Added: plugins option for the phenomic loader.
    This option allow more flexibility on how to handle and transform
    input passed to it.
    By default, almost the same behavior as before is executed via the following plugins:

      plugins: [
        phenomicLoaderPlugins.initHeadPropertyFromConfig,
        phenomicLoaderPlugins.initHeadPropertyFromContent,
        phenomicLoaderPlugins.initBodyPropertyFromContent,
        phenomicLoaderPlugins.markdownInitHeadDescriptionPropertyFromContent,
        phenomicLoaderPlugins.markdownTransformBodyPropertyToHtml,
      ]

    See the configuration section in the documentation to know more how to customize this.
    If you want just add more plugins for specific behavior (and so keep
    the default plugins), you can spread some plugins/presets.
    (see documentation for more informations).
    (#260 - @MoOx)

  • Added: "phenomic" package now exposes new values

    • phenomicLoader (ex "phenomic/lib/content-loader")
    • phenomicLoaderPlugins, the list of all available plugins
    • phenomicLoaderPresets, that contains default and markdown presets
      (see documentation for more informations).
      (@MoOx)
  • Added: More routes can be pre-rendered! Previously, only files consumed
    via phenomic-loader (former content-loader) where generated as HTML.
    Now your routes are consumed and pre-rendered when possible!
    This is super convenient to define pages that will list content by tags,
    categories, authors etc!

    Here is a simple example to add pages for each tags by editing
    web_modules/app/routes.js (if you still use default location):

    export default (
      <Route component={ LayoutContainer }>
        <Route path="tag/:tag" component={ ContainerThatWillListPostByTag } />
        <Route path="*" component={ PageContainer } />
      </Route>
    )

    Obviously, you will need to define ContainerThatWillListPostByTag
    (and find a better name for it).
    Here is an example on a website that implemented this:
    β†’ Example of implementation of some tags and authors pages.
    Please check out "Routing" section in the docs for more details.
    Good news: pagination is on the roadmap!
    (@MoOx)

Boilerplate

  • Fixed: (boilerplate) postcss-browser-reporter was added on production
    only when it should have been the opposite!
    (@MoOx)
  • Changed: (boilerplate) LayoutContainer now import global CSS first
    (#571 - @AdamQuadmon)
  • Changed: (boilerplate) content-loader reference is now in a variable
    that can be imported (import { phenomicLoader } from "phenomic")
    (@MoOx)

Don't miss a new phenomic release

NewReleases is sending notifications on new releases.