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

[Experimental] Add super rudimentary support for plugins #1299

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,8 @@ if ( config.isEnabled( 'mailing-lists/unsubscribe' ) ) {
} );
}

if ( config( 'plugins' ) ) {
sections = sections.concat( config( 'plugins' ) );
}

module.exports = sections;
7 changes: 7 additions & 0 deletions config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@
"pub/hexa",
"pub/harmonic"
],
"plugins": [
{
"name": "hello-world",
"paths": [ "/hello-world" ],
"module": "hello-world"
}
],
"languages": [
{ "value": 2, "langSlug": "af", "name": "af - Afrikaans" },
{ "value": 418, "langSlug": "als", "name": "als - Alemannisch" },
Expand Down
12 changes: 12 additions & 0 deletions plugins/hello-world/components/hello/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

export default React.createClass( {
render() {
return (
<div>
<h3>Hello, World!</h3>
</div>
);
}
} )

9 changes: 9 additions & 0 deletions plugins/hello-world/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import Hello from './components/hello';

export default function helloController() {
React.render(
<Hello />,
document.getElementById( 'primary' )
);
}
9 changes: 9 additions & 0 deletions plugins/hello-world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* External dependencies
*/
import page from 'page';
import controller from './controller';

export default function helloWorld() {
page( '/hello-world', controller );
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ webpackConfig = {
},
resolve: {
extensions: [ '', '.json', '.js', '.jsx' ],
modulesDirectories: [ 'node_modules', path.join( __dirname, 'client' ), path.join( __dirname, 'shared' ) ]
modulesDirectories: [ 'node_modules', path.join( __dirname, 'client' ), path.join( __dirname, 'shared' ), path.join( __dirname, 'plugins' ) ]
},
node: {
console: false,
Expand Down