Skip to content
This repository was archived by the owner on Jul 19, 2021. It is now read-only.

Breaking: assets/vendors to assets/static #519

Merged
merged 1 commit into from
May 2, 2018
Merged
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
6 changes: 3 additions & 3 deletions packages/slate-tools/slate-tools.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = generate({
items: [
{
id: 'webpackCommonExcludes',
default: ['node_modules', 'assets/vendors/'],
default: ['node_modules', 'assets/static/'],
description: 'Paths to exclude for all webpack loaders',
type: 'array',
},
Expand Down Expand Up @@ -81,8 +81,8 @@ module.exports = generate({
default: resolveTheme('src'),
},
{
id: 'vendors',
default: resolveTheme('src/assets/vendors'),
id: 'static',
default: resolveTheme('src/assets/static'),
},
{
id: 'scripts',
Expand Down
12 changes: 6 additions & 6 deletions packages/slate-tools/tools/webpack/config/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const path = require('path');
const webpack = require('webpack');
const WriteFileWebpackPlugin = require('write-file-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const commonExcludes = require('../common-excludes');
const babelLoader = require('../loaders/babel-loader');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = require('../../../slate-tools.config');
const {entrypointFiles} = require('../entrypoints');

Expand All @@ -18,7 +18,7 @@ const extractLiquidStyles = new ExtractTextPlugin(

/**
* Return an array of ContextReplacementPlugin to use.
* Omit the __appvendors__ replacement if the directory does not exists.
* Omit the __appstatic__ replacement if the directory does not exists.
*
* @see https://webpack.js.org/plugins/context-replacement-plugin/#newcontentcallback
*/
Expand All @@ -37,11 +37,11 @@ function contextReplacementPlugins() {
),
];

if (fs.existsSync(paths.vendors)) {
if (fs.existsSync(paths.static)) {
plugins.push(
new webpack.ContextReplacementPlugin(
/__appvendors__/,
replaceCtxRequest(paths.vendors),
/__appstatic__/,
replaceCtxRequest(paths.static),
),
);
}
Expand Down Expand Up @@ -117,7 +117,7 @@ module.exports = {
},
},
{
test: /assets\/vendors\//,
test: /assets\/static\//,
exclude: /node_modules/,
loader: 'file-loader',
options: {
Expand Down
6 changes: 3 additions & 3 deletions packages/slate-tools/tools/webpack/static-files-glob.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// This is used as an entry point in webpack.base.conf.js. It dynamically
// require all liquid and json files from the user's directory (except theme.liquid)
// as well as everything inside the src/assets/vendors directory.
// as well as everything inside the src/assets/static directory.
//
// Why not use require.context() you ask ? This would work if we'd want to require
// files from this tool's directory, but not from the user's directory, as you can't
Expand All @@ -21,11 +21,11 @@
//
// For the `ContextReplacementPlugin` to kick in, we need to make our require
// dynamic, hence the use of a variable (`dynamicCtx`).
// The context we look for, and replace, is the `__app[src|vendors]__` part.
// The context we look for, and replace, is the `__app[src|static]__` part.
//
var dynamicCtx = 'salut';
require('__appsrc__/layout' + dynamicCtx + '.liquid');
require('__appsrc__/sections' + dynamicCtx + '.liquid');
require('__appsrc__/snippets' + dynamicCtx + '.liquid');
require('__appsrc__/templates' + dynamicCtx + '.liquid');
require('__appvendors__/' + dynamicCtx);
require('__appstatic__/' + dynamicCtx);