Skip to content

Commit

Permalink
Merge pull request #23 from PlatoCreative/3.6.0
Browse files Browse the repository at this point in the history
Laravel Mix & Composer updates
  • Loading branch information
mediabeastnz authored Jun 12, 2017
2 parents 0a50fea + 369faaa commit 5656d8a
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 88 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
!/phpunit.xml
!/gulpfile.js
!/package.json
!/webpack.config.js
!/webpack.mix.js
!favicon.ico
*Thumbs.db
*web.config
Expand All @@ -32,3 +32,4 @@
*.sublime-*
*.sass-cache
*prepros.cfg
*mix-manifest.json
17 changes: 7 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"name": "plato-creative/plato-silverstripe-installer",
"description": "Custom built SilverStripe installer with Foundation.",
"description": "Custom built SilverStripe installer with Foundation",
"type": "silverstripe-module",
"homepage": "https://github.com/PlatoCreative/plato-silverstripe-installer",
"keywords": ["silverstripe", "installer", "plato", "creative", "foundation"],
"keywords": ["silverstripe", "installer", "plato creative"],
"authors": [
{
"name": "Myles Beardsmore",
"email": "[email protected]"
},
{
"name": "Gorrie Coe",
"email": "[email protected]"
"name": "Plato Creative",
"email": "[email protected]"
}
],
"require": {
Expand All @@ -35,10 +31,11 @@
"markguinn/silverstripe-email-helpers": "1.2.*",
"plato-creative/silverstripe-styleguide": "1.*",
"undefinedoffset/silverstripe-nocaptcha": "0.2.*",
"tractorcow/silverstripe-dynamiccache": "4.1.*"
"tractorcow/silverstripe-dynamiccache": "4.1.*",
"ryanpotter/silverstripe-cms-theme": "^1.0"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7"
"phpunit/PHPUnit": "~3.7@stable"
},
"prefer-stable": true,
"minimum-stability": "dev"
Expand Down
24 changes: 0 additions & 24 deletions gulpfile.js

This file was deleted.

3 changes: 3 additions & 0 deletions mysite/_config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ SmtpMailer:
password:
tls: true
charset: UTF-8
LeftAndMain:
cms_menu_color: '#ffffff'
cms_menu_background: '#000000'
21 changes: 15 additions & 6 deletions package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
{
"private": true,
"dependencies": {
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-p": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"cross-env": "^3.2.3",
"foundation-sites": "6.3.*",
"gulp": "^3.9.1",
"jquery": "2.2.3",
"jquery-fancybox": "^3.1.0",
"laravel-elixir": "6.0.0-15",
"laravel-elixir-webpack-official": "^1.0.10",
"script-loader": "^0.7.0"
"jquery-match-height": "^0.7.2",
"laravel-mix": "^0.*"
}
}
61 changes: 43 additions & 18 deletions themes/base/js/app.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@

// Require jQuery
window.$ = window.jQuery = require('jquery/dist/jquery.js');
// Require Foundation
/**
* Load Plugins
* If you don't see a plugin below it might be autloaded via webpack
* Check webpack.mix.js for autoloaded plugins.
*/
require('foundation-sites');
require('jquery-match-height');


/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}

(function($) {
/**
*
* Application script
*
*/
$(function() {

// init Foundation
$(document).foundation();

$(document).ready(function() {
// google analytics
$('[data-ga-label]').each(function(){
$(this).on('click', function() {
var $trackingName = $(this).data('ga-label'),
$tagName = $(this).prop("tagName"),
$action = 'click';
if($tagName=='input'){
$action = 'submit';
}
ga('send', 'event', 'button', $action, $trackingName);
});
// google analytics
$('[data-ga-label]').each(function(){
$(this).on('click', function() {
var $trackingName = $(this).data('ga-label'),
$tagName = $(this).prop("tagName"),
$action = 'click';
if($tagName=='input'){
$action = 'submit';
}
ga('send', 'event', 'button', $action, $trackingName);
});
});

}(jQuery));
});
1 change: 1 addition & 0 deletions themes/base/templates/Page.ss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="csrf-token" content="{$SecurityID}">
$MetaTags(false)

<% require themedCSS('app') %>
Expand Down
29 changes: 0 additions & 29 deletions webpack.config.js

This file was deleted.

23 changes: 23 additions & 0 deletions webpack.mix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*-------------------------------------------------------------------
Required plugins
-------------------------------------------------------------------*/
const { mix } = require('laravel-mix');

/*-------------------------------------------------------------------
Tasks
-------------------------------------------------------------------*/
mix.autoload({
'jquery': ['$', 'jQuery', 'window.jQuery'],
'axios': ['window.axios']
})
.js('themes/base/js/app.js', 'themes/base/js/app.min.js').sourceMaps()
.sass('themes/base/scss/app.scss', 'themes/base/css/').options({
processCssUrls: false
})
.sass('themes/base/scss/editor.scss', 'themes/base/css/');

// BrowserSync - e.g. "localhost/mysite.com"
mix.browserSync({
proxy: 'localhost/[YOURSITENAME.CO.NZ]',
files: ["themes/base/css/*", "themes/base/js/app.min.js", "themes/base/templates/*.ss", "themes/base/templates/*/*.ss"]
});

0 comments on commit 5656d8a

Please sign in to comment.