-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from Automattic/add/fix-build-and-refactor
v.1 refactoring
- Loading branch information
Showing
46 changed files
with
1,636 additions
and
1,628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
# newspack-content-converter | ||
Plugin which mass-converts pre-Gutenberg Classic HTML Posts and Pages to the Gutenberg Blocks. | ||
Mass-conversion of pre-Gutenberg Classic HTML Posts and Pages to the Gutenberg Blocks. | ||
|
||
### Disclaimer | ||
|
||
Please make sure to back up your site contents fully, because this converter updates the content permanently by replacing the classic HTML content with Gutenberg Blocks content. | ||
Make sure to back up your site contents fully, because this converter updates the content of your database permanently by replacing the classic HTML content with Gutenberg Blocks content. | ||
|
||
This plugin is open source, and the creators can not be held responsible for any data loss or consequences of its usage. | ||
|
||
The plugin is presently in Alpha, and used primarily as a Developer's tool -- please check back for a full and improved version soon. | ||
### Convert HTML to Blocks | ||
|
||
The "Newspack Content Converter" > "Converter" submenu item in the Dashboard's main allows you to mass convert all your HTML posts to Gutenberg blocks. | ||
|
||
### Usage | ||
Every time this screen is loaded, it will scan your existing posts and display the number of unconverted posts which can then be converted. All Posts which do not begin with block syntax `<!-- wp...` can be converted. | ||
|
||
Clicking "Newspack Content Converter" in the Admin area's main left-hand menu, opens a page where the number of Posts and number of batches queued for Conversion is displayed. Clicking the "Run conversion" button there actually initializes the conversion and starts converting your queued Posts and Pages to Blocks. | ||
Click "Run conversion" to actually begin the conversion. The page will reloaded and conversion will begin. This page with conversion running should not be stopped or closed until it is fully completed. | ||
|
||
After a conversion is complete, it's sometimes necessary to flush the cache, as well. | ||
While the conversion is running, a link will allow you to open several conversion browser tabs at once, which can speed up the entire conversion. Each such additional tab picks up the next batch of posts an converts it in a parallel process. Depending on your computer performance, it is usually recommended to run between 1 to 10 maximum parallel tabs. | ||
|
||
After running Newspack Content Converter, if you need to undo the conversion, you restore the `wp_posts` table to its pre-conversion state by running `wp newspack-content-converter restore-content`. This will also undo any other editorial changes that have been made to the content in the interim. | ||
In case that the conversion page gets closed or unexpectedly terminated while it hasn't finished converting, the "Converter" page will let you "Reset" the conversion and simply continue where you left off. | ||
|
||
To re-scan your freshest HTML Posts, and to update the conversion queue, run the CLI command `wp newspack-content-converter reset`. | ||
After the conversion is complete, it may be necessary to flush the object cache to see the effects in Gutenberg editor or the front page. | ||
|
||
#### If the conversion page is not loading | ||
|
||
After "Run conversion" is clicked, if the conversion page is not properly displaying and running, an alert with an error message will pop up after some time. | ||
|
||
If the problem persists, temporarily deactivate all other active plugins and try running the conversion again. Once the conversion is complete, reactivate your site plugins. | ||
|
||
#### Restore original content | ||
|
||
Plugin backs up and stores original post content before conversion to blocks as custom postmeta. The "Restore content" page allows you to restore converted posts to the latest available backup. | ||
|
||
It also lets you delete all this custom postmeta from your database, which will permanently delete the backups. | ||
|
||
#### Settings | ||
|
||
"Settings" page displays the post types and post statuses which get converted. | ||
|
||
### Development | ||
|
||
- `composer install` | ||
- `nvm use 16` | ||
- `npm ci --legacy-peer-deps` | ||
- `npm run build` | ||
- Run `npm run release:archive` to package a release. The archive will be created in `assets/release/newspack-content-converter.zip` | ||
- Run `npm start` to compile the JS files, and start file watcher | ||
- `npm ci` | ||
- `npm run build` for a single build or `npm start` to compile the JS files and start the file watcher | ||
- `npm run release:archive` to package a release. The archive will be created in `assets/release/newspack-content-converter.zip` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.