Skip to content
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

Front end styling for blocks. #1217

Closed
wants to merge 1 commit into from

Commits on Jun 16, 2017

  1. Front end styling for blocks.

    Came across some interesting hurdles:
    
    1. Block names most likely need to be registered server side in addition
    to client side.
    
    I forgot to write down the other ones lol.
    
    This PR seeks to add two different features and maybe should be split
    into two seperate PRs.
    
    Function 1: Dynamically break any blocks.scss files into a seperate
    file, so any default blocks styles which need to be displayed in both
    the editor and the theme, can be used. This is only currently used for
    adding gallery columns.
    
    Function 2: Adds an api for registering additional styles and scripts
    for blocks, to the theme, as well as to the editor itself. A low level
    API `register_block_assets()` is introduced as the backbone to some of
    the easier to use functions like: gutenberg_add_block_editor_style(),
    which mirrors the use of enqueue styles. The loading of these scripts
    and styles is handle automatically, and I think the end developer
    experience is already pretty good.
    
    Currently scripts can be only registered to blocks that have been
    previously registered. If the block is not present a _doing_it_wront()
    is thrown to help guide the programmer.
    
    **Testing Instructions**
    
    1. Create a gallery block on the backend with two columns. Verify that
    the columns display correctly, and then on the front end of that post
    verify that the same gallery columns style applies.
    
    2. Use the block style registry for testing additional styles being
    added. For ease, you can use the example provided above, but I recommend
    taking everything for a spin.
    BE-Webdesign committed Jun 16, 2017
    Configuration menu
    Copy the full SHA
    e85ccb5 View commit details
    Browse the repository at this point in the history