Skins support

This commit is contained in:
kibigo! 2017-11-30 19:29:47 -08:00
parent 8812bab687
commit 541fe9b110
22 changed files with 157 additions and 85 deletions

View File

@ -12,6 +12,8 @@ class ApplicationController < ActionController::Base
helper_method :current_account helper_method :current_account
helper_method :current_session helper_method :current_session
helper_method :current_theme
helper_method :current_skin
helper_method :single_user_mode? helper_method :single_user_mode?
rescue_from ActionController::RoutingError, with: :not_found rescue_from ActionController::RoutingError, with: :not_found
@ -52,14 +54,14 @@ class ApplicationController < ActionController::Base
new_user_session_path new_user_session_path
end end
def pack(data, pack_name) def pack(data, pack_name, skin = 'default')
return nil unless pack?(data, pack_name) return nil unless pack?(data, pack_name)
pack_data = { pack_data = {
common: pack_name == 'common' ? nil : resolve_pack(data['name'] ? Themes.instance.get(current_theme) : Themes.instance.core, 'common'), common: pack_name == 'common' ? nil : resolve_pack(data['name'] ? Themes.instance.get(current_theme) : Themes.instance.core, 'common'),
name: data['name'], name: data['name'],
pack: pack_name, pack: pack_name,
preload: nil, preload: nil,
stylesheet: false skin: nil,
} }
if data['pack'][pack_name].is_a?(Hash) if data['pack'][pack_name].is_a?(Hash)
pack_data[:common] = nil if data['pack'][pack_name]['use_common'] == false pack_data[:common] = nil if data['pack'][pack_name]['use_common'] == false
@ -68,7 +70,11 @@ class ApplicationController < ActionController::Base
pack_data[:preload] = [data['pack'][pack_name]['preload']] if data['pack'][pack_name]['preload'].is_a?(String) pack_data[:preload] = [data['pack'][pack_name]['preload']] if data['pack'][pack_name]['preload'].is_a?(String)
pack_data[:preload] = data['pack'][pack_name]['preload'] if data['pack'][pack_name]['preload'].is_a?(Array) pack_data[:preload] = data['pack'][pack_name]['preload'] if data['pack'][pack_name]['preload'].is_a?(Array)
end end
pack_data[:stylesheet] = true if data['pack'][pack_name]['stylesheet'] if skin != 'default' && data['skin'][skin]
pack_data[:skin] = skin if data['skin'][skin].include?(pack_name)
else # default skin
pack_data[:skin] = 'default' if data['pack'][pack_name]['stylesheet']
end
end end
pack_data pack_data
end end
@ -80,39 +86,39 @@ class ApplicationController < ActionController::Base
false false
end end
def nil_pack(data, pack_name) def nil_pack(data, pack_name, skin = 'default')
{ {
common: pack_name == 'common' ? nil : resolve_pack(data['name'] ? Themes.instance.get(current_theme) : Themes.instance.core, 'common'), common: pack_name == 'common' ? nil : resolve_pack(data['name'] ? Themes.instance.get(current_theme) : Themes.instance.core, 'common', skin),
name: data['name'], name: data['name'],
pack: nil, pack: nil,
preload: nil, preload: nil,
stylesheet: false skin: nil,
} }
end end
def resolve_pack(data, pack_name) def resolve_pack(data, pack_name, skin = 'default')
result = pack(data, pack_name) result = pack(data, pack_name, skin)
unless result unless result
if data['name'] && data.key?('fallback') if data['name'] && data.key?('fallback')
if data['fallback'].nil? if data['fallback'].nil?
return nil_pack(data, pack_name) return nil_pack(data, pack_name, skin)
elsif data['fallback'].is_a?(String) && Themes.instance.get(data['fallback']) elsif data['fallback'].is_a?(String) && Themes.instance.get(data['fallback'])
return resolve_pack(Themes.instance.get(data['fallback']), pack_name) return resolve_pack(Themes.instance.get(data['fallback']), pack_name, skin)
elsif data['fallback'].is_a?(Array) elsif data['fallback'].is_a?(Array)
data['fallback'].each do |fallback| data['fallback'].each do |fallback|
return resolve_pack(Themes.instance.get(fallback), pack_name) if Themes.instance.get(fallback) return resolve_pack(Themes.instance.get(fallback), pack_name, skin) if Themes.instance.get(fallback)
end end
end end
return nil_pack(data, pack_name) return nil_pack(data, pack_name, skin)
end end
return data.key?('name') && data['name'] != default_theme ? resolve_pack(Themes.instance.get(default_theme), pack_name) : nil_pack(data, pack_name) return data.key?('name') && data['name'] != default_theme ? resolve_pack(Themes.instance.get(default_theme), pack_name, skin) : nil_pack(data, pack_name, skin)
end end
result result
end end
def use_pack(pack_name) def use_pack(pack_name)
@core = resolve_pack(Themes.instance.core, pack_name) @core = resolve_pack(Themes.instance.core, pack_name)
@theme = resolve_pack(Themes.instance.get(current_theme), pack_name) @theme = resolve_pack(Themes.instance.get(current_theme), pack_name, current_skin)
end end
protected protected
@ -154,6 +160,15 @@ class ApplicationController < ActionController::Base
current_user.setting_theme current_user.setting_theme
end end
def default_skin
'default'
end
def current_skin
return default_skin unless Themes.instance.skins_for(current_theme).include? current_user&.setting_skin
current_user.setting_skin
end
def cache_collection(raw, klass) def cache_collection(raw, klass)
return raw unless klass.respond_to?(:with_includes) return raw unless klass.respond_to?(:with_includes)

View File

@ -39,6 +39,7 @@ class Settings::PreferencesController < Settings::BaseController
:setting_system_font_ui, :setting_system_font_ui,
:setting_noindex, :setting_noindex,
:setting_theme, :setting_theme,
:setting_skin,
notification_emails: %i(follow follow_request reblog favourite mention digest), notification_emails: %i(follow follow_request reblog favourite mention digest),
interactions: %i(must_be_follower must_be_following) interactions: %i(must_be_follower must_be_following)
) )

View File

@ -1,5 +1,8 @@
// This file will be loaded on all pages, regardless of theme. // This file will be loaded on all pages, regardless of theme.
import { start } from 'rails-ujs'; import { start } from 'rails-ujs';
import 'font-awesome/css/font-awesome.css';
require.context('images/', true);
start(); start();

View File

@ -3,6 +3,8 @@
const { length } = require('stringz'); const { length } = require('stringz');
const { delegate } = require('rails-ujs'); const { delegate } = require('rails-ujs');
import { processBio } from 'themes/glitch/util/bio_metadata';
delegate(document, '.account_display_name', 'input', ({ target }) => { delegate(document, '.account_display_name', 'input', ({ target }) => {
const nameCounter = document.querySelector('.name-counter'); const nameCounter = document.querySelector('.name-counter');
@ -35,3 +37,7 @@ delegate(document, '#account_header', 'change', ({ target }) => {
header.style.backgroundImage = `url(${url})`; header.style.backgroundImage = `url(${url})`;
}); });
delegate(document, '#user_setting_theme', 'change', ({ target }) => {
target.form.submit();
});

View File

@ -4,7 +4,9 @@ pack:
about: about:
admin: admin.js admin: admin.js
auth: auth:
common: common.js common:
filename: common.js
stylesheet: true
embed: embed.js embed: embed.js
error: error:
home: home:

View File

@ -1,3 +1 @@
import 'font-awesome/css/font-awesome.css'; import 'styles/application.scss';
import 'styles/application.scss'
require.context('../images/', true);

View File

@ -0,0 +1 @@
@import 'styles/win95';

View File

@ -2075,7 +2075,7 @@
.getting-started { .getting-started {
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 235px; padding-bottom: 235px;
background: url('../images/mastodon-getting-started.png') no-repeat 0 100%; background: url('~images/mastodon-getting-started.png') no-repeat 0 100%;
flex: 1 0 auto; flex: 1 0 auto;
p { p {
@ -2270,7 +2270,7 @@ button.icon-button.active i.fa-retweet {
justify-content: center; justify-content: center;
& > div { & > div {
background: url('../images/mastodon-not-found.png') no-repeat center -50px; background: url('~images/mastodon-not-found.png') no-repeat center -50px;
padding-top: 210px; padding-top: 210px;
width: 100%; width: 100%;
} }
@ -3143,7 +3143,7 @@ button.icon-button.active i.fa-retweet {
img, img,
canvas { canvas {
display: block; display: block;
background: url('../images/void.png') repeat; background: url('~images/void.png') repeat;
object-fit: contain; object-fit: contain;
} }
@ -3390,7 +3390,7 @@ button.icon-button.active i.fa-retweet {
} }
.onboarding-modal__page-one__elephant-friend { .onboarding-modal__page-one__elephant-friend {
background: url('../images/elephant-friend-1.png') no-repeat center center / contain; background: url('~images/elephant-friend-1.png') no-repeat center center / contain;
width: 155px; width: 155px;
height: 193px; height: 193px;
margin-right: 15px; margin-right: 15px;

View File

@ -1,7 +1,7 @@
// win95 theme from cybrespace. // win95 theme from cybrespace.
// Modified to inherit glitch styles (themes/glitch/styles/index.scss) // Modified by kibi! to use webpack package syntax for urls (eg,
// instead of vanilla ones (./application.scss) // `url(~images/)`) for easy importing into skins.
$win95-bg: #bfbfbf; $win95-bg: #bfbfbf;
$win95-dark-grey: #404040; $win95-dark-grey: #404040;
@ -73,10 +73,10 @@ $ui-highlight-color: $win95-window-header;
@font-face { @font-face {
font-family:"premillenium"; font-family:"premillenium";
src: url('../fonts/premillenium/MSSansSerif.ttf') format('truetype'); src: url('~fonts/premillenium/MSSansSerif.ttf') format('truetype');
} }
@import '../themes/glitch/styles/index'; // Imports glitch themes @import 'application';
/* borrowed from cybrespace style: wider columns and full column width images */ /* borrowed from cybrespace style: wider columns and full column width images */
@ -179,7 +179,7 @@ body.admin {
font-size:0px; font-size:0px;
color:$win95-bg; color:$win95-bg;
background-image: url("../images/start.png"); background-image: url("~images/start.png");
background-repeat:no-repeat; background-repeat:no-repeat;
background-position:8%; background-position:8%;
background-clip:padding-box; background-clip:padding-box;
@ -716,7 +716,7 @@ body.admin {
font-size:0px; font-size:0px;
color:$win95-bg; color:$win95-bg;
background-image: url("../images/start.png"); background-image: url("~images/start.png");
background-repeat:no-repeat; background-repeat:no-repeat;
background-position:8%; background-position:8%;
background-clip:padding-box; background-clip:padding-box;
@ -1055,40 +1055,40 @@ body.admin {
} }
.column-link[href="/web/timelines/public"] { .column-link[href="/web/timelines/public"] {
background-image: url("../images/icon_public.png"); background-image: url("~images/icon_public.png");
&:hover { background-image: url("../images/icon_public.png"); } &:hover { background-image: url("~images/icon_public.png"); }
} }
.column-link[href="/web/timelines/public/local"] { .column-link[href="/web/timelines/public/local"] {
background-image: url("../images/icon_local.png"); background-image: url("~images/icon_local.png");
&:hover { background-image: url("../images/icon_local.png"); } &:hover { background-image: url("~images/icon_local.png"); }
} }
.column-link[href="/web/pinned"] { .column-link[href="/web/pinned"] {
background-image: url("../images/icon_pin.png"); background-image: url("~images/icon_pin.png");
&:hover { background-image: url("../images/icon_pin.png"); } &:hover { background-image: url("~images/icon_pin.png"); }
} }
.column-link[href="/web/favourites"] { .column-link[href="/web/favourites"] {
background-image: url("../images/icon_likes.png"); background-image: url("~images/icon_likes.png");
&:hover { background-image: url("../images/icon_likes.png"); } &:hover { background-image: url("~images/icon_likes.png"); }
} }
.column-link[href="/web/blocks"] { .column-link[href="/web/blocks"] {
background-image: url("../images/icon_blocks.png"); background-image: url("~images/icon_blocks.png");
&:hover { background-image: url("../images/icon_blocks.png"); } &:hover { background-image: url("~images/icon_blocks.png"); }
} }
.column-link[href="/web/mutes"] { .column-link[href="/web/mutes"] {
background-image: url("../images/icon_mutes.png"); background-image: url("~images/icon_mutes.png");
&:hover { background-image: url("../images/icon_mutes.png"); } &:hover { background-image: url("~images/icon_mutes.png"); }
} }
.column-link[href="/settings/preferences"] { .column-link[href="/settings/preferences"] {
background-image: url("../images/icon_settings.png"); background-image: url("~images/icon_settings.png");
&:hover { background-image: url("../images/icon_settings.png"); } &:hover { background-image: url("~images/icon_settings.png"); }
} }
.column-link[href="/about/more"] { .column-link[href="/about/more"] {
background-image: url("../images/icon_about.png"); background-image: url("~images/icon_about.png");
&:hover { background-image: url("../images/icon_about.png"); } &:hover { background-image: url("~images/icon_about.png"); }
} }
.column-link[href="/auth/sign_out"] { .column-link[href="/auth/sign_out"] {
background-image: url("../images/icon_logout.png"); background-image: url("~images/icon_logout.png");
&:hover { background-image: url("../images/icon_logout.png"); } &:hover { background-image: url("~images/icon_logout.png"); }
} }
.getting-started__footer { .getting-started__footer {

View File

@ -1,3 +1 @@
import 'font-awesome/css/font-awesome.css';
require.context('images/', true);
import 'themes/glitch/styles/index.scss'; import 'themes/glitch/styles/index.scss';

View File

@ -1,5 +1,4 @@
import loadPolyfills from 'themes/glitch/util/load_polyfills'; import loadPolyfills from 'themes/glitch/util/load_polyfills';
import { processBio } from 'themes/glitch/util/bio_metadata';
import ready from 'themes/glitch/util/ready'; import ready from 'themes/glitch/util/ready';
function main() { function main() {

View File

@ -1,10 +0,0 @@
// These lines are the same as in glitch:
import 'font-awesome/css/font-awesome.css';
require.context('../../images/', true);
// …But we want to use our own styles instead.
import 'styles/win95.scss';
// Be sure to make this style file import from
// `themes/glitch/styles/index.scss` (the glitch styling), and not
// `application.scss` (which are the vanilla styles).

View File

@ -1,18 +0,0 @@
# win95 theme.
# Ported over from `cybrespace:mastodon/theme_win95`.
# <https://github.com/cybrespace/mastodon/tree/theme_win95>
# You can use this theme file as inspiration for porting over
# a preëxisting Mastodon theme.
# We only modify the `common` pack, which contains our styling.
pack:
common:
filename: index.js
stylesheet: true
# All unspecified packs will inherit from glitch.
# The `fallback` parameter tells us to use glitch files for everything
# we haven't specified.
fallback: glitch

View File

@ -17,10 +17,31 @@ class Themes
name = File.basename(File.dirname(path)) name = File.basename(File.dirname(path))
if data['pack'] if data['pack']
data['name'] = name data['name'] = name
data['skin'] = { 'default' => [] }
result[name] = data result[name] = data
end end
end end
Dir.glob(Rails.root.join('app', 'javascript', 'skins', '*', '*')) do |path|
ext = File.extname(path)
skin = File.basename(path)
name = File.basename(File.dirname(path))
if result[name]
if File.directory?(path)
pack = []
Dir.glob(File.join(path, '*.{css,scss}')) do |sheet|
pack.push(File.basename(sheet, File.extname(sheet)))
end
elsif ext.match?(/^\.s?css$/i)
skin = File.basename(path, ext)
pack = ['common']
end
if skin != 'default'
result[name]['skin'][skin] = pack
end
end
end
@core = core @core = core
@conf = result @conf = result
@ -37,4 +58,8 @@ class Themes
def names def names
@conf.keys @conf.keys
end end
def skins_for(name)
@conf[name]['skin'].keys
end
end end

View File

@ -27,6 +27,7 @@ class UserSettingsDecorator
user.settings['system_font_ui'] = system_font_ui_preference if change?('setting_system_font_ui') user.settings['system_font_ui'] = system_font_ui_preference if change?('setting_system_font_ui')
user.settings['noindex'] = noindex_preference if change?('setting_noindex') user.settings['noindex'] = noindex_preference if change?('setting_noindex')
user.settings['theme'] = theme_preference if change?('setting_theme') user.settings['theme'] = theme_preference if change?('setting_theme')
user.settings['skin'] = skin_preference if change?('setting_skin')
end end
def merged_notification_emails def merged_notification_emails
@ -76,7 +77,11 @@ class UserSettingsDecorator
def theme_preference def theme_preference
settings['setting_theme'] settings['setting_theme']
end end
def skin_preference
settings['setting_skin']
end
def boolean_cast_setting(key) def boolean_cast_setting(key)
settings[key] == '1' settings[key] == '1'
end end

View File

@ -74,7 +74,7 @@ class User < ApplicationRecord
has_many :session_activations, dependent: :destroy has_many :session_activations, dependent: :destroy
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal, delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal,
:reduce_motion, :system_font_ui, :noindex, :theme, :reduce_motion, :system_font_ui, :noindex, :theme, :skin,
to: :settings, prefix: :setting, allow_nil: false to: :settings, prefix: :setting, allow_nil: false
def confirmed? def confirmed?

View File

@ -3,8 +3,11 @@
= render partial: 'layouts/theme', object: theme[:common] = render partial: 'layouts/theme', object: theme[:common]
- if theme[:pack] - if theme[:pack]
= javascript_pack_tag theme[:name] ? "themes/#{theme[:name]}/#{theme[:pack]}" : "core/#{theme[:pack]}", integrity: true, crossorigin: 'anonymous' = javascript_pack_tag theme[:name] ? "themes/#{theme[:name]}/#{theme[:pack]}" : "core/#{theme[:pack]}", integrity: true, crossorigin: 'anonymous'
- if theme[:stylesheet] - if theme[:skin]
= stylesheet_pack_tag theme[:name] ? "themes/#{theme[:name]}/#{theme[:pack]}" : "core/#{theme[:pack]}", integrity: true, media: 'all' - if !theme[:name] || theme[:skin] == 'default'
= stylesheet_pack_tag theme[:name] ? "themes/#{theme[:name]}/#{theme[:pack]}" : "core/#{theme[:pack]}", integrity: true, media: 'all'
- else
= stylesheet_pack_tag "skins/#{theme[:name]}/#{theme[:skin]}/#{theme[:pack]}"
- if theme[:preload] - if theme[:preload]
- theme[:preload].each do |link| - theme[:preload].each do |link|
%link{ href: asset_pack_path("#{link}.js"), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/ %link{ href: asset_pack_path("#{link}.js"), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/

View File

@ -28,6 +28,7 @@
.fields-group .fields-group
- if Themes.instance.names.size > 1 - if Themes.instance.names.size > 1
= f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_label, include_blank: false = f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_label, include_blank: false
= f.input :setting_skin, collection: Themes.instance.skins_for(current_theme), label_method: lambda { |skin| I18n.t("themes.#{current_theme}.skins.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false
= f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label
= f.input :setting_boost_modal, as: :boolean, wrapper: :with_label = f.input :setting_boost_modal, as: :boolean, wrapper: :with_label

View File

@ -15,6 +15,7 @@ en:
other: <span class="note-counter">%{count}</span> characters left other: <span class="note-counter">%{count}</span> characters left
setting_noindex: Affects your public profile and status pages setting_noindex: Affects your public profile and status pages
setting_theme: Affects how Mastodon looks when you're logged in from any device. setting_theme: Affects how Mastodon looks when you're logged in from any device.
setting_skin: Reskins the selected Mastodon theme
imports: imports:
data: CSV file exported from another Mastodon instance data: CSV file exported from another Mastodon instance
sessions: sessions:
@ -47,6 +48,7 @@ en:
setting_reduce_motion: Reduce motion in animations setting_reduce_motion: Reduce motion in animations
setting_system_font_ui: Use system's default font setting_system_font_ui: Use system's default font
setting_theme: Site theme setting_theme: Site theme
setting_skin: Skin
setting_unfollow_modal: Show confirmation dialog before unfollowing someone setting_unfollow_modal: Show confirmation dialog before unfollowing someone
severity: Severity severity: Severity
type: Import type type: Import type

View File

@ -26,6 +26,7 @@ defaults: &defaults
system_font_ui: false system_font_ui: false
noindex: false noindex: false
theme: 'glitch' theme: 'glitch'
skin: 'default'
notification_emails: notification_emails:
follow: false follow: false
reblog: false reblog: false

View File

@ -1,15 +1,16 @@
// Common configuration for webpacker loaded from config/webpacker.yml // Common configuration for webpacker loaded from config/webpacker.yml
const { basename, dirname, join, resolve } = require('path'); const { basename, dirname, extname, join, resolve } = require('path');
const { env } = require('process'); const { env } = require('process');
const { safeLoad } = require('js-yaml'); const { safeLoad } = require('js-yaml');
const { readFileSync } = require('fs'); const { lstatSync, readFileSync } = require('fs');
const glob = require('glob'); const glob = require('glob');
const configPath = resolve('config', 'webpacker.yml'); const configPath = resolve('config', 'webpacker.yml');
const loadersDir = join(__dirname, 'loaders'); const loadersDir = join(__dirname, 'loaders');
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV]; const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
const themeFiles = glob.sync('app/javascript/themes/*/theme.yml'); const themeFiles = glob.sync('app/javascript/themes/*/theme.yml');
const skinFiles = glob.sync('app/javascript/skins/*/*');
const themes = {}; const themes = {};
const core = function () { const core = function () {
@ -25,14 +26,35 @@ for (let i = 0; i < themeFiles.length; i++) {
const themeFile = themeFiles[i]; const themeFile = themeFiles[i];
const data = safeLoad(readFileSync(themeFile), 'utf8'); const data = safeLoad(readFileSync(themeFile), 'utf8');
data.name = basename(dirname(themeFile)); data.name = basename(dirname(themeFile));
data.skin = {};
if (!data.pack_directory) { if (!data.pack_directory) {
data.pack_directory = dirname(themeFile); data.pack_directory = dirname(themeFile);
} }
if (data.pack && typeof data.pack == 'object') { if (data.pack && typeof data.pack === 'object') {
themes[data.name] = data; themes[data.name] = data;
} }
} }
for (let i = 0; i < skinFiles.length; i++) {
const skinFile = skinFiles[i];
let skin = basename(skinFile);
const name = basename(dirname(skinFile));
if (!themes[name]) {
continue;
}
const data = themes[name].skin;
if (lstatSync(skinFile).isDirectory()) {
data[skin] = {};
const skinPacks = glob.sync(skinFile, '*.{css,scss}');
for (let j = 0; j < skinPacks.length; j++) {
const pack = skinPacks[i];
data[skin][basename(pack, extname(pack))] = pack;
}
} else if ((skin = skin.match(/^(.*)\.s?css$/i))) {
data[skin[1]] = { common: skinFile };
}
}
function removeOuterSlashes(string) { function removeOuterSlashes(string) {
return string.replace(/^\/*/, '').replace(/\/*$/, ''); return string.replace(/^\/*/, '').replace(/\/*$/, '');
} }

View File

@ -1,7 +1,7 @@
// Note: You must restart bin/webpack-dev-server for changes to take effect // Note: You must restart bin/webpack-dev-server for changes to take effect
const webpack = require('webpack'); const webpack = require('webpack');
const { basename, dirname, join, relative, resolve } = require('path'); const { basename, join, resolve } = require('path');
const { sync } = require('glob'); const { sync } = require('glob');
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin'); const ManifestPlugin = require('webpack-manifest-plugin');
@ -24,6 +24,24 @@ function reducePacks (data, into = {}) {
} }
return map; return map;
}, into); }, into);
if (data.name) {
Object.keys(data.skin).reduce((map, entry) => {
const skin = data.skin[entry];
const skinName = entry;
if (!skin) {
return map;
}
Object.keys(skin).reduce((map, entry) => {
const packFile = skin[entry];
if (!packFile) {
return map;
}
map[`skins/${data.name}/${skinName}/${entry}`] = resolve(packFile);
return map;
}, into);
return map;
}, into);
}
return into; return into;
} }