Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert van Lienden committed May 16, 2021
0 parents commit 5b94999
Show file tree
Hide file tree
Showing 36 changed files with 10,515 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"es6": true,
"browser": true,
"node": true,
"jquery": true
},
"extends" : "airbnb",
"rules" : {
"no-new": 0, ,
"no-param-reassign": [2, { "props": false }]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v10.23.0
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Robert van Lienden

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# SilverStripe Bulma Dark Theme
By Robert van Lienden (https://www.robertvanlienden.nl - Twitter [@Robertvlienden](https://www.twitter.com/robertvlienden))

This theme is a great start if you want to use [Bulma CSS Framework](https://bulma.io/) for your [SilverStripe](https://silverstripe.org) site.

![Screenshot SilverStripe Bulma Dark Theme](screenshots/img_1.png "Screenshot")

## Requirements

### Installation
- SilverStripe 4

### Development
- Node Package Manager (npm)
- Node Version Manager (nvm)

## Installation

- `cd <silverstripe dir>`
- `git clone <git repo> themes/bulma-dark-theme`
- Change your `app/_config/theme.yml` to:
```yaml
---
Name: mytheme
---
SilverStripe\View\SSViewer:
themes:
- '$public'
- 'bulma-dark-theme'
- '$default'

```
- Change the `composer.json` config with the following lines:
```json
"extra": {
"resources-dir": "_resources",
"expose": [
"themes/bulma-dark-theme/css",
"themes/bulma-dark-theme/javascript",
"themes/bulma-dark-theme/webfonts",
"themes/bulma-dark-theme/images"
],
```


### TinyMCE Config

Copy the code from `themes/bulma-dark-theme/TinyMCE.php` to `app/_config/_config.php` to
add corrent formatting for headings and some other bulma elements.

## Developing

Make sure you got the development requirements and start developing with the following commands:

- `cd <path to this theme>`
- `nvm use`
- `npm install`
- `npm run watch`

Now Gulp is watching for JS/SCSS changes in the src folder.

### Build

Want to make a JS/CSS build for production? Just run;
`npm make build` and let gulp compile the production assets.

## License

This theme is published under MIT License.
Reuse, edit, modify, sell, do whatever you want with this base template.

If you use this theme commercial and make money with this theme, please be kind and do a donation with PayPal (see Donations below).

## Issue/PR

Feel free to make some issue/PR if you find issues/bugs/improvements.

## Donations

Do you want to thank me for making this SilverStripe theme?

Please donate to me with PayPal! You can donate on [Paypal.me/robertvanlienden](http://paypal.me/robertvanlienden).
30 changes: 30 additions & 0 deletions TinyMCE.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use SilverStripe\Forms\HTMLEditor\HTMLEditorConfig;
use SilverStripe\Forms\HTMLEditor\TinyMCEConfig;

$formats = [
[ 'title' => 'Headings', 'items' => [
['title' => 'Heading 1', 'block' => 'h1', 'classes' => 'title is-1'],
['title' => 'Heading 2', 'block' => 'h2', 'classes' => 'title is-2'],
['title' => 'Heading 3', 'block' => 'h3', 'classes' => 'title is-1'],
['title' => 'Heading 4', 'block' => 'h4', 'classes' => 'title is-4'],
['title' => 'Heading 5', 'block' => 'h5', 'classes' => 'title is-5'],
['title' => 'Heading 6', 'block' => 'h6', 'classes' => 'title is-6'],
['title' => 'Heading 6', 'block' => 'h6', 'classes' => 'title is-6'],
[
'title' => 'Subtitle',
'selector' => 'p',
'classes' => 'title-sub',
],
]
],
];

TinyMCEConfig::get('cms')
->addButtonsToLine(2, 'styleselect')
->setOptions([
'importcss_append' => true,
'style_formats' => $formats,
])
->removeButtons('formatselect');
Empty file added css/.gitignore
Empty file.
1 change: 1 addition & 0 deletions css/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions css/editor.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions css/main.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions css/vendors/bulma.css

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const javascriptEntry = 'src/javascript/app.js';
const javascriptSrc = 'src/javascript/**/*.js';
const javascriptDest = 'javascript';

const eslint = require('gulp-eslint');

const sass = require('gulp-sass');

const sassSrc = 'src/sass/**/*.scss';
const sassDest = 'css';

const editorSassSrc = 'src/editor/**/*.scss';
const editorSassDest = 'css';

const gulp = require('gulp');

const webpack = require('webpack');
const webpackStream = require('webpack-stream');
const webpackConfig = require('./webpack.config.js');

// This function can be used to copy fonts to the webfonts dir
function copyFonts() {
// return gulp.src([
//
// ])
// .pipe(gulp.dest('webfonts'));
}

function buildJs() {
return gulp.src(javascriptEntry)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(webpackStream(webpackConfig), webpack)
.pipe(gulp.dest(javascriptDest));
}

function watchJs() {
gulp.watch(javascriptSrc, buildJs);
}

function buildSass() {
return gulp.src(sassSrc)
.pipe(sass({
outputStyle: 'compressed',
}))
.on('error', sass.logError)
.pipe(gulp.dest(sassDest));
}

function buildEditorSass() {
return gulp.src(editorSassSrc)
.pipe(sass({
outputStyle: 'compressed',
}))
.on('error', sass.logError)
.pipe(gulp.dest(editorSassDest));
}

function watchSass() {
gulp.watch(sassSrc, buildSass);
gulp.watch(editorSassSrc, buildEditorSass);
}

exports.copyFonts = copyFonts;
exports.js = buildJs;
exports.watchjs = watchJs;

exports.sass = buildSass;
exports.watchSass = watchSass;

exports.buildEditorSass = buildEditorSass;

exports.default = gulp.parallel(copyFonts, buildJs, buildSass, buildEditorSass, watchJs, watchSass);
Empty file added javascript/.gitignore
Empty file.
113 changes: 113 additions & 0 deletions javascript/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/javascript/app.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./src/javascript/app.js":
/*!*******************************!*\
!*** ./src/javascript/app.js ***!
\*******************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _hamburger_nav__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hamburger-nav */ \"./src/javascript/hamburger-nav.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// eslint-disable-next-line import/no-webpack-loader-syntax,import/no-unresolved,no-unused-vars\n// import $ from 'expose-loader?exposes[]=$&exposes[]=jQuery!jquery';\n\n\nvar App = function App() {\n _classCallCheck(this, App);\n\n new _hamburger_nav__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n};\n\n(function () {\n return new App({});\n})();\n\n//# sourceURL=webpack:///./src/javascript/app.js?");

/***/ }),

/***/ "./src/javascript/hamburger-nav.js":
/*!*****************************************!*\
!*** ./src/javascript/hamburger-nav.js ***!
\*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return HamburgerNav; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar HamburgerNav = function HamburgerNav() {\n _classCallCheck(this, HamburgerNav);\n\n document.addEventListener('DOMContentLoaded', function () {\n // Get all \"navbar-burger\" elements\n var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); // Check if there are any navbar burgers\n\n if ($navbarBurgers.length > 0) {\n // Add a click event on each of them\n $navbarBurgers.forEach(function (el) {\n el.addEventListener('click', function () {\n // Get the target from the \"data-target\" attribute\n var target = el.dataset.target;\n var $target = document.getElementById(target); // Toggle the \"is-active\" class on both the \"navbar-burger\" and the \"navbar-menu\"\n\n el.classList.toggle('is-active');\n $target.classList.toggle('is-active');\n });\n });\n }\n });\n};\n\n\n\n//# sourceURL=webpack:///./src/javascript/hamburger-nav.js?");

/***/ })

/******/ });
Empty file added javascript/combined.min.js
Empty file.
Loading

0 comments on commit 5b94999

Please sign in to comment.