Skip to content
Permalink
Browse files

Closes #171 - Papertrain now uses server-side compiling

  • Loading branch information...
codewithkyle committed Jun 8, 2019
1 parent 45ba2ce commit de4282b21d58e40283b90b92ae5c3cf1af00d135
@@ -38,3 +38,4 @@ logs/
.stylelintcache
_compiled
.editorconfig
/config/papertrain/automation.php
@@ -7,10 +7,13 @@
- Adds: basic Imager config to the `/config` directory [#168](https://github.com/Pageworks/papertrain/issues/168)
- Adds: Papertrain module and `craft.papertrain.getAssetPaths()` variable [#170](https://github.com/Pageworks/papertrain/issues/170)
- Adds: server-side compiling [#171](https://github.com/Pageworks/papertrain/issues/171)
- Adds: Moves Env class instantiation to the Application class
- Adds: Added a public static `Env.startLoading()` and `Env.stopLoading()` class to triggering the loading animation

### Fixed

- Fixes: `.gitignore` file wasn't remove the leading `/` from the vendor directory line
- Fixes: removes the Pjax class instantiation due to minor Pjax bugs (temporary fix)

### Removed

@@ -6,7 +6,7 @@
* list of the available settings in vendor/craftcms/cms/src/config/GeneralConfig.php.
*/
return [
$customConfig = [
// Global settings
'*' => [
'defaultWeekStartDay' => 0,
@@ -18,12 +18,13 @@
'useCompressedJs' => true,
'phpSessionName' => 'cpsessid',
'sendPoweredByHeader' => false,
'loginPath' => 'users/login',
'activateAccountSuccessPath' => 'users/profile',
'invalidUserTokenPath' => 'users/invalid',
'setPasswordPath' => 'users/password',
'loginPath' => 'user/login',
'activateAccountSuccessPath' => 'user/welcome',
'invalidUserTokenPath' => 'user/registration-error',
'setPasswordSuccessPath' => 'user/login',
'purgePendingUsersDuration' => 'P1M',
'useProjectConfigFile' => true,
],
// Dev environment settings
@@ -61,6 +62,7 @@
];
// If a local config file exists, merge any local config settings
if (is_array($customLocalConfig = include('papertrain/automation.php'))) {
$customGlobalConfig = array_merge($customConfig['*'], $customLocalConfig);
$customConfig['*'] = $customGlobalConfig;
@@ -14,6 +14,7 @@
use Craft;
use craft\base\Component;
use craft\helpers\StringHelper;
/**
* @author Kyle Andrews
@@ -1,7 +1,7 @@
{
"name": "papertrain",
"description": "Papertrain: a Craft CMS toolkit",
"version": "0.1.0",
"version": "0.2.0",
"author": "Pageworks",
"license": "MIT",
"repository": {
@@ -69,7 +69,7 @@
{# <link rel="manifest" href="{{ alias('@rootUrl')|trim('/') }}/manifest.json"> #}

<!-- Required CSS -->
{% inlucde "_layouts/global-css.twig" %}
{% include "_layouts/global-css.twig" %}

{# Loading animation CSS #}
<style>
@@ -239,9 +239,11 @@
<main role="main" class="js-pjax">
{% block content %}{% endblock %}
</main>
{% do view.registerJsFile( alias('@rootUrl')|trim('/') ~ '/assets/scripts/application.' ~ craft.app.config.general.jsCacheBustTimestamp ~ '.js') %}
{% endspaceless %}

{% set applicationPaths = craft.papertrain.getAssetPaths(['application']) %}
{% do view.registerJsFile(applicationPaths['application'].module) %}

<noscript>
<div style="position:fixed;bottom:0;left:0;padding:16px 32px;border-radius:8px 8px 0 0;text-align:center;background-color:#ffffff;box-shadow:0 -1px 3px rgba(0,0,0,0.15), 0 -4px 32px rgba(0,0,0,0.1);left:50%;transform:translateX(-50%);z-index:99999;">
<p>{{ "This website requires JavaScript to function propery. Please enable JavaScript and refresh the page."|t }}</p>
@@ -1,9 +1,12 @@
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/main.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/fonts.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/utility.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/spacing.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/ratio.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/widths.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/container.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/wrapper.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
<link rel="stylesheet" href="{{ alias('@rootUrl')|trim('/') }}/assets/styles/grid.{{ craft.app.config.general.cssCacheBustTimestamp }}.css">
{% set globalCssAssets = craft.papertrain.getAssetPaths(['main', 'fonts', 'utility', 'spacing', 'ratio', 'widths', 'container', 'wrapper', 'grid']) %}


{% do view.registerCssFile(globalCssAssets['main'].css) %}
{% do view.registerCssFile(globalCssAssets['fonts'].css) %}
{% do view.registerCssFile(globalCssAssets['utility'].css) %}
{% do view.registerCssFile(globalCssAssets['spacing'].css) %}
{% do view.registerCssFile(globalCssAssets['ratio'].css) %}
{% do view.registerCssFile(globalCssAssets['widths'].css) %}
{% do view.registerCssFile(globalCssAssets['container'].css) %}
{% do view.registerCssFile(globalCssAssets['wrapper'].css) %}
{% do view.registerCssFile(globalCssAssets['grid'].css) %}
@@ -9,7 +9,9 @@
}
</script>

{% do view.registerJsFile( alias('@rootUrl')|trim('/') ~ '/assets/scripts/runtime.' ~ craft.app.config.general.jsCacheBustTimestamp ~ '.js') %}
{% do view.registerJsFile( alias('@rootUrl')|trim('/') ~ '/assets/scripts/globals.' ~ craft.app.config.general.jsCacheBustTimestamp ~ '.js', {"async":"async"}) %}
{% do view.registerJsFile( alias('@rootUrl')|trim('/') ~ '/assets/scripts/npm.uuid.' ~ craft.app.config.general.jsCacheBustTimestamp ~ '.js', {"async":"async"}) %}
{% do view.registerJsFile( alias('@rootUrl')|trim('/') ~ '/assets/scripts/npm.pageworks.' ~ craft.app.config.general.jsCacheBustTimestamp ~ '.js', {"async":"async"}) %}
{% set globalAssets = craft.papertrain.getAssetPaths(['runtime', 'globals', 'uuid', 'pageworks']) %}

{% do view.registerJsFile(globalAssets['runtime'].module) %}
{% do view.registerJsFile(globalAssets['globals'].module, {"async":"async"}) %}
{% do view.registerJsFile(globalAssets['uuid'].package, {"async":"async"}) %}
{% do view.registerJsFile(globalAssets['pageworks'].package, {"async":"async"}) %}
@@ -1,5 +1,5 @@
{% do view.registerCssFile(alias('@rootUrl')|trim('/') ~ '/assets/styles/homepage.' ~ craft.app.config.general.cssCacheBustTimestamp ~ '.css') %}

{% set homepageAssets = craft.papertrain.getAssetPaths(['homepage']) %}
{% do view.registerCssFile(homepageAssets['homepage'].css) %}

{% extends "_layouts/base" %}

@@ -10,7 +10,9 @@ export class Application{

constructor(){
new DeviceManager(Env.isDebug, true);
new Pjax({ debug: Env.isDebug });
// new Pjax({ debug: Env.isDebug });
new Env();
Env.stopLoading();
}

/**
@@ -2,6 +2,13 @@ export class Env {

public static isDebug:boolean = false;

public static EASING:IEasingObject = {
ease: 'cubicBezier(0.4, 0.0, 0.2, 1)',
in: 'cubicBezier(0.0, 0.0, 0.2, 1)',
out: 'cubicBezier(0.4, 0.0, 1, 1)',
sharp: 'cubicBezier(0.4, 0.0, 0.6, 1)'
};

constructor(){
if(window.location.hostname.match(/.local/)){
// Checks if the hostname is set to `.local`
@@ -20,6 +27,14 @@ export class Env {
public static setDebug(status:boolean):void{
Env.isDebug = status;
}
}

new Env();
/** Plays the global loading animation */
public static startLoading():void{
document.documentElement.classList.add('dom-is-loading');
}

/** Stops the global loading animation */
public static stopLoading():void{
document.documentElement.classList.remove('dom-is-loading');
}
}
@@ -2,3 +2,10 @@
declare var modules: { [index:string]: Function };

declare module 'uuid/v4';

interface IEasingObject{
ease: string;
in: string;
out: string;
sharp: string;
}
@@ -36,7 +36,7 @@ var{

script,
style{
display: initial !important;
display: none !important;
}

sup,
@@ -136,6 +136,7 @@ fieldset{
font-size: 16px;
line-height: 1.618;
border-radius: 0;
color: inherit;

&:focus,
&:active{
@@ -202,9 +203,11 @@ input[type="color"]::-webkit-color-swatch {
}

select{
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
html.has-js & {
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
}
}

fieldset{
@@ -11,16 +11,24 @@ html
min-height: 100vh;
text-align: left;
position: relative;
overflow-x: hidden;
}

body{
background: $base-background-color;
overflow: hidden;
width: 100vw;
min-height: 100vh;
overflow-x: hidden;

main{
min-height: 80vh;
width: 100%;
padding-top: 126px;
line-height: 0;

@media (min-width: $screen-medium){
padding-top: 125px;
}
}
}

@@ -1,4 +1,4 @@
const path = require('path');
const path = require('path');
const glob = require("glob");
const fs = require('fs');
const rimraf = require("rimraf");

0 comments on commit de4282b

Please sign in to comment.
You can’t perform that action at this time.