AlloyEditor will make this content editable
To install React, follow the instructions on GitHub.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel metus nunc. Maecenas rhoncus congue faucibus. Sed finibus ultrices turpis. Mauris nulla ante, aliquam a euismod ut, scelerisque nec sem. Nam dapibus ac nulla non ullamcorper. Sed vestibulum a velit non lobortis. Proin sit amet imperdiet urna. Aenean interdum urna augue, vel mollis tortor dictum vitae. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris vitae suscipit magna.
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var del = require('del');
2 | var envify = require('gulp-envify');
3 | var gulp = require('gulp');
4 | var gutil = require('gutil');
5 | var path = require('path');
6 | var runSequence = require('run-sequence');
7 | var template = require('gulp-template');
8 | var uglify = require('gulp-uglify');
9 | var webpack = require('webpack');
10 |
11 | var renderOnServer = require('./src/server');
12 |
13 | gulp.task('webpack', function(callback) {
14 | // run webpack
15 | webpack({
16 | entry: {
17 | app: './src/client.js',
18 | vendor: ['alloyeditor', 'react', 'react-dom'],
19 | },
20 | output: {
21 | filename: './dist/bundle.js'
22 | },
23 | module: {
24 | context: path.join(__dirname, 'node_modules'),
25 | loaders: [
26 | {
27 | test: /\.jsx?$/,
28 | exclude: /(node_modules|bower_components)/,
29 | loader: 'babel',
30 | query: {
31 | presets: ['react', 'es2015']
32 | }
33 | }
34 | ]
35 | },
36 | plugins: [
37 | new webpack.optimize.CommonsChunkPlugin('vendor', './dist/vendor.bundle.js')
38 | ]
39 | }, function(err) {
40 | if (err) {
41 | throw new gutil.PluginError('webpack', err);
42 | }
43 |
44 | callback();
45 | });
46 | });
47 |
48 | gulp.task('build', function(callback) {
49 | runSequence('clean', ['webpack', 'copy-alloyeditor', 'render-on-server'], callback);
50 | });
51 |
52 | gulp.task('clean', function(callback) {
53 | del('./dist')
54 | .then(function() {
55 | callback();
56 | });
57 | });
58 |
59 | gulp.task('copy-alloyeditor', function() {
60 | return gulp.src(['./node_modules/alloyeditor/dist/alloy-editor/**/*'])
61 | .pipe(gulp.dest('./dist/alloyeditor'));
62 | });
63 |
64 | gulp.task('default', function(callback) {
65 | runSequence(['build'], callback);
66 | });
67 |
68 | gulp.task('minimize', function() {
69 | return gulp.src(['dist/bundle.js', 'dist/vendor.bundle.js'])
70 | .pipe(envify())
71 | .pipe(uglify())
72 | .pipe(gulp.dest('dist'));
73 | });
74 |
75 | gulp.task('render-on-server', function () {
76 | return gulp.src('src/index.html')
77 | .pipe(template({
78 | content: renderOnServer()
79 | }))
80 | .pipe(gulp.dest('dist'));
81 | });
82 |
83 | gulp.task('release', function(callback) {
84 | process.env.NODE_ENV = 'production';
85 |
86 | runSequence('build', 'minimize', callback);
87 | });
88 |
89 | gulp.task('watch', ['build'], function(callback) {
90 | gulp.watch('src/**/*', ['build'], callback);
91 | });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "alloyeditor-react-component",
3 | "repository": {
4 | "type": "git",
5 | "url": "https://github.com/ipeychev/alloyeditor-react-component.git"
6 | },
7 | "description": "An example usage of AlloyEditor on the server and in the browser",
8 | "version": "1.1.0",
9 | "main": "server.js",
10 | "dependencies": {
11 | "alloyeditor": "^1.4.1",
12 | "babel-core": "^6.3.26",
13 | "babel-loader": "^6.2.0",
14 | "babel-preset-es2015": "^6.3.13",
15 | "babel-preset-react": "^6.3.13",
16 | "babel-register": "^6.3.13",
17 | "del": "^2.2.0",
18 | "gulp": "^3.9.0",
19 | "gulp-envify": "^1.0.0",
20 | "gulp-template": "^3.1.0",
21 | "gulp-uglify": "^1.5.1",
22 | "gutil": "^1.6.4",
23 | "react": "^15.5.4",
24 | "react-dom": "^15.5.4",
25 | "run-sequence": "^1.1.5",
26 | "webpack": "^1.12.9"
27 | },
28 | "scripts": {
29 | "build": "gulp build",
30 | "release": "gulp release",
31 | "test": "echo \"Error: no test specified\" && exit 1"
32 | },
33 | "bugs": {
34 | "url": "https://github.com/ipeychev/alloyeditor-react-component/issues"
35 | },
36 | "author": "Iliyan Peychev