Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
feat: Update package versions and order they should be imported
Browse files Browse the repository at this point in the history
feat: Change expose style config
  • Loading branch information
SofiaSousa committed Nov 7, 2018
1 parent 0dfef26 commit d3e784d
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 103 deletions.
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,44 @@
],
"dependencies": {
"@wordpress/a11y": "^2.0.2",
"@wordpress/api-fetch": "^2.2.1",
"@wordpress/api-fetch": "2.2.2",
"@wordpress/autop": "^2.0.2",
"@wordpress/blob": "^2.1.0",
"@wordpress/block-library": "^2.1.7",
"@wordpress/block-serialization-default-parser": "^1.0.1",
"@wordpress/blocks": "^5.1.1",
"@wordpress/components": "^5.0.1",
"@wordpress/core-data": "^2.0.8",
"@wordpress/data": "^3.0.1",
"@wordpress/block-library": "2.1.8",
"@wordpress/block-serialization-default-parser": "^1.0.2",
"@wordpress/blocks": "5.1.2",
"@wordpress/components": "^5.0.2",
"@wordpress/core-data": "^2.0.9",
"@wordpress/data": "^3.1.0",
"@wordpress/date": "^2.1.0",
"@wordpress/deprecated": "^2.0.3",
"@wordpress/dom": "^2.0.4",
"@wordpress/dom-ready": "^2.0.2",
"@wordpress/edit-post": "^2.0.2",
"@wordpress/editor": "^6.1.0",
"@wordpress/edit-post": "2.0.3",
"@wordpress/editor": "6.1.1",
"@wordpress/element": "^2.1.5",
"@wordpress/escape-html": "^1.0.1",
"@wordpress/format-library": "^1.0.3",
"@wordpress/hooks": "^2.0.3",
"@wordpress/html-entities": "^2.0.2",
"@wordpress/i18n": "^3.0.1",
"@wordpress/is-shallow-equal": "^1.1.4",
"@wordpress/keycodes": "^2.0.3",
"@wordpress/nux": "^2.0.8",
"@wordpress/notices": "^1.0.2",
"@wordpress/nux": "^2.0.9",
"@wordpress/plugins": "^2.0.6",
"@wordpress/redux-routine": "^3.0.3",
"@wordpress/rich-text": "^2.0.1",
"@wordpress/rich-text": "^2.0.2",
"@wordpress/shortcode": "^2.0.2",
"@wordpress/token-list": "^1.0.2",
"@wordpress/url": "^2.2.0",
"@wordpress/viewport": "^2.0.7",
"@wordpress/url": "~2.2.0",
"@wordpress/viewport": "^2.0.8",
"@wordpress/wordcount": "^2.0.3",
"tinymce": "4.8.0"
},
"devDependencies": {
"@wordpress/babel-plugin-makepot": "^1.0.1",
"@wordpress/scripts": "^1.2.0",
"@wordpress/babel-plugin-makepot": "^2.1.2",
"@wordpress/scripts": "^2.4.1",
"babel-core": "^6.26.3",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
Expand All @@ -84,13 +86,12 @@
"extract-text-webpack-plugin": "4.0.0-beta.0",
"node-sass": "git://github.com/sass/node-sass.git#v4.7.0",
"path-replace-loader": "^2.0.0",
"pegjs": "0.10.0",
"postcss-color-function": "4.0.1",
"postcss-loader": "2.1.3",
"postcss-wrapper-loader": "0.0.2",
"string-replace-webpack-plugin": "^0.1.3",
"raw-loader": "0.5.1",
"sass-loader": "6.0.7",
"string-replace-webpack-plugin": "^0.1.3",
"webpack": "4.8.3",
"webpack-cli": "2.1.3"
},
Expand Down
121 changes: 64 additions & 57 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,130 +6,137 @@ import './init';
/**
* WordPress dependencies
*/
import * as hooks from '@wordpress/hooks';
import domReady from '@wordpress/dom-ready';
import * as a11y from '@wordpress/a11y';
import * as i18n from '@wordpress/i18n';
// wp.i18n.setLocaleData

import * as url from '@wordpress/url';
import apiFetch from '@wordpress/api-fetch';
import './scripts/api-fetch.js';

import * as autop from '@wordpress/autop';
import * as blob from '@wordpress/blob';
import * as blockSerializationDefaultParser from '@wordpress/block-serialization-default-parser';
import deprecated from '@wordpress/deprecated';
import * as escapeHtml from '@wordpress/escape-html';
import * as element from '@wordpress/element';
import * as isShallowEqual from '@wordpress/is-shallow-equal';
import * as compose from '@wordpress/compose';
import * as hooks from '@wordpress/hooks';
import deprecated from '@wordpress/deprecated';
import * as reduxRoutine from '@wordpress/redux-routine';

import * as data from '@wordpress/data';
import './scripts/data.js';

import * as dom from '@wordpress/dom';
import * as i18n from '@wordpress/i18n';
import * as shortcode from '@wordpress/shortcode';
import * as blocks from '@wordpress/blocks';
import domReady from '@wordpress/dom-ready';
import * as a11y from '@wordpress/a11y';

import * as url from '@wordpress/url';
import apiFetch from '@wordpress/api-fetch';
import './scripts/api-fetch.js';
// wp.blocks.setCategories
// wp.blocks.unstable__bootstrapServerSideBlockDefinitions

import * as htmlEntities from '@wordpress/html-entities';
import * as keycodes from '@wordpress/keycodes';
import * as richText from '@wordpress/rich-text';
import * as components from '@wordpress/components';
import * as coreData from '@wordpress/core-data';
import * as date from '@wordpress/date';
// wp.date.setSettings

import * as notices from '@wordpress/notices';
import * as nux from '@wordpress/nux';
import * as tokenList from '@wordpress/token-list';
import * as viewport from '@wordpress/viewport';
import * as wordcount from '@wordpress/wordcount';
// _wpMetaBoxUrl

import { editor, oldEditor } from './scripts/editor.js';
// window._wpGutenbergCodeEditorSettings

import * as plugins from '@wordpress/plugins';
import * as blockLibrary from '@wordpress/block-library';
import * as editPost from '@wordpress/edit-post';
import * as formatLibrary from '@wordpress/format-library';

// Style
import '@wordpress/components/build-style/style.css';
import '@wordpress/nux/build-style/style.css';
import '@wordpress/editor/build-style/style.css';
import '@wordpress/block-library/build-style/theme.css';
import '@wordpress/block-library/build-style/editor.css';
import '@wordpress/edit-post/build-style/style.css';
import '../scss/block-library.scss';
import '../scss/style.scss';

// Set global wp
window.wp = {
a11y,
apiFetch,
url,

autop,
blob,
blockLibrary,
blockSerializationDefaultParser,
escapeHtml,
element,
isShallowEqual,
blocks,
components,
compose,
hooks,
deprecated,
reduxRoutine,
coreData,
data,
date,
deprecated,
dom,
i18n,
shortcode,
blocks,
domReady,
a11y,
editPost,
editor,
element,
escapeHtml,
formatLibrary,
hooks,
htmlEntities,
i18n,
isShallowEqual,
keycodes,
richText,
components,
coreData,
date,
notices,
nux,
oldEditor,
plugins,
reduxRoutine,
richText,
shortcode,
tokenList,
url,
viewport,
wordcount,
editor,
oldEditor,
plugins,
blockLibrary,
editPost,
};

export {
a11y,
apiFetch,
url,

autop,
blob,
blockLibrary,
blockSerializationDefaultParser,
escapeHtml,
element,
isShallowEqual,
blocks,
components,
compose,
hooks,
deprecated,
reduxRoutine,
coreData,
data,
date,
deprecated,
dom,
i18n,
shortcode,
blocks,
domReady,
a11y,
editPost,
editor,
element,
escapeHtml,
formatLibrary,
hooks,
htmlEntities,
i18n,
isShallowEqual,
keycodes,
richText,
components,
coreData,
date,
notices,
nux,
oldEditor,
plugins,
reduxRoutine,
richText,
shortcode,
tokenList,
url,
viewport,
wordcount,
editor,
oldEditor,
plugins,
blockLibrary,
editPost,
};
10 changes: 10 additions & 0 deletions src/scss/block-library.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import '~@wordpress/block-library/build-style/style.css';

/*
* TEMPORARY FIXES
*/

// gutenberg/packages/block-library/src/media-text/style.scss
.wp-block-media-text.has-media-on-the-right {
grid-template-areas: "media-text-content media-text-media";
}
9 changes: 8 additions & 1 deletion src/scss/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
// @import 'gbcolors';
@import '~@wordpress/format-library/build-style/style.css';
@import '~@wordpress/components/build-style/style.css';
@import '~@wordpress/nux/build-style/style.css';
@import '~@wordpress/editor/build-style/style.css';
@import '~@wordpress/block-library/build-style/theme.css';
@import '~@wordpress/block-library/build-style/editor.css';
@import '~@wordpress/edit-post/build-style/style.css';

@import 'media-library';

@media (min-width: 600px) {
Expand Down
45 changes: 17 additions & 28 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
* External dependencies
*/
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const postcss = require('postcss');

const { resolve } = require('path');

/**
* Gutenberg-js dependencies
*/
const extractCSS = new ExtractTextPlugin('./css/style.css');
const extractBLCSS = new ExtractTextPlugin('./css/block-library/style.css');

// const PostCssWrapper = require('postcss-wrapper-loader');
// const StringReplacePlugin = require('string-replace-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
Expand Down Expand Up @@ -65,7 +63,6 @@ module.exports = {
modules: [
__dirname,
resolve(__dirname, 'node_modules'),
// resolve(__dirname, 'node_modules/gutenberg/node_modules'),
],
alias,
},
Expand Down Expand Up @@ -117,8 +114,18 @@ module.exports = {
}),
},*/
{
test: /\.s?css$/,
use: ExtractTextPlugin.extract({
test: /style\.s?css$/,
use: extractCSS.extract({
fallback: 'style-loader', // creates style nodes from JS strings
use: [
{ loader: 'css-loader' }, // translates CSS into CommonJS
{ loader: 'sass-loader' }, // compiles Sass to CSS
],
}),
},
{
test: /block-library\.s?css$/,
use: extractBLCSS.extract({
fallback: 'style-loader', // creates style nodes from JS strings
use: [
{ loader: 'css-loader' }, // translates CSS into CommonJS
Expand All @@ -129,30 +136,12 @@ module.exports = {
],
},
plugins: [
new ExtractTextPlugin('./css/style.css'),
extractCSS,
extractBLCSS,
// wrapping editor style with .gutenberg__editor class
// new PostCssWrapper('./css/block-library/edit-blocks.css', '.gutenberg__editor'),
// new StringReplacePlugin(),
new CleanWebpackPlugin(['build']),
new CopyWebpackPlugin([
{
from: `./node_modules/@wordpress/block-library/build-style/style.css`,
to: `./css/block-library/`,
flatten: true,
transform: content => {
if (process.env.NODE_ENV === 'production') {
return postcss([
require('cssnano')({
preset: 'default',
}),
])
.process(content, { from: 'src/app.css', to: 'dest/app.css' })
.then(result => result.css);
}
return content;
},
},
]),
],
stats: {
children: false,
Expand Down

0 comments on commit d3e784d

Please sign in to comment.