I can’t show you this code in full context because it’s in a private repository.
| @@ -0,0 +1,51 @@ | ||
| # Slider Block | ||
| | ||
| The slider block allows a user to insert a slideshow-style block | ||
| with both dot and arrow controls. | ||
| | ||
| There is no limit to the number of slides. This block uses | ||
| Accessible Slick for the frontend and is responsible for | ||
| managing the slider behavior. Layouts are in the slide block. | ||
| | ||
| Autoplay is not supported because it goes against BU MWAS. | ||
| | ||
| A matching Slide block is the only child block allowed inside the | ||
| slider block. The Slide block has a number of preset content variations, | ||
| including testimonials, profile grid, photos, video, gallery, and columns. | ||
| | ||
| ## What's in here? | ||
| | ||
| - A `current` folder. This is the current version of your block, | ||
| and where you will be working most of the time. Inside of this folder, | ||
| you'll find: | ||
| - `_style.scss`: Write all styles for the frontend of this block here. | ||
| (Editor-specific styles should go in editor.scss.) | ||
| - `config.js`: Your block configuration goes here. | ||
| - `edit.js`: All block admin editing functions go here. | ||
| - `markup.js`: Your basic HTML and output will go here. Designers - start here! | ||
| Developers: this is where you will go to connect frontend to backend code. This | ||
| file controls the display of both the Gutenberg view and the website view of the block | ||
| by default. | ||
| - `save.js`: Code related to how the block displays on the frontend goes here. | ||
| - A `deprecated` folder. This is where you should go if you need to | ||
| deprecate a block. **Always deprecate before changing code that could | ||
| affect existing content on websites, even markup!** Inside, you'll find: | ||
| - A set of folders which holds the code for each version of the block that has been | ||
| deprecated | ||
| - A file which controls the deprecated versions | ||
| - `index.js` is responsible for registering your block. You'll only | ||
| need to update this once with the namespace of the block, when you | ||
| begin development. | ||
| | ||
| ## To make your new block available to WordPress | ||
| | ||
| - Import it to `src/index.js` | ||
| - Import the sass in `src/_index.scss` | ||
| | ||
| ## Can't compile? | ||
| | ||
| - If you've removed the deprecated folder because you are using PHP rendering | ||
| insted of JavaScript rendering, you may run into an error where even though you've | ||
| deleted all references to a certain file or folder, you still get an error that it is | ||
| missing. To fix this, you need to clear the cache by deleting node_modules and rerunning | ||
| `npm install`. |