Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Clean up frontend code
Browse files Browse the repository at this point in the history
  • Loading branch information
hmans committed Jun 2, 2018
1 parent 60c39ff commit 1e70941
Show file tree
Hide file tree
Showing 33 changed files with 72 additions and 64 deletions.
3 changes: 1 addition & 2 deletions src/crankypants/web/views/layouts/blog.slang
Expand Up @@ -14,8 +14,7 @@ html
a href="/" = Crankypants.settings.site_title

main
.container
== content
== content

footer role="main"
.container
Expand Down
10 changes: 7 additions & 3 deletions src/crankypants/web/views/post_view/index.slang
@@ -1,6 +1,10 @@
- posts_by_day = posts.group_by { |p| p.created_at.not_nil!.to_s("%B %-d") }
- posts_by_day.each do |day, posts|
h2.day-header = day
header role="posts"
.container
h2.day-header = day

section.posts
- posts.each do |post|
== PostView._post(post)
.container
- posts.each do |post|
== PostView._post(post)
21 changes: 21 additions & 0 deletions web/app.coffee
@@ -0,0 +1,21 @@
# Entrypoint for Crankypants' management app.

import Vue from 'vue'

# add some CSS we want
import 'normalize.css'
import '@/directives/v-prism'

# Require the bits and pieces that form our app
import App from '@/components/App'
import store from '@/store'
import router from '@/router'

# CSS
import "@/styles/app.scss"

new Vue
el: '#app'
store: store
router: router
render: (h) -> h(App)
17 changes: 0 additions & 17 deletions web/app/index.coffee

This file was deleted.

18 changes: 18 additions & 0 deletions web/blog.coffee
@@ -0,0 +1,18 @@
# Entrypoint for Crankypants' user-facing blog. Much lighter than its
# management app (see app.coffee.)

import "normalize.css"
import "@/styles/blog.scss"

# Yes, we use Turbolinks. Crankypants would already be crazy fast without it,
# but using Turbolinks also frees the browser from having to reevaluate all
# JSS and CSS on every request. It's mighty fine!
import Turbolinks from "turbolinks"
Turbolinks.start()

# Initialize syntax highlighting.
import Prism from "@/lib/loadPrism"
import 'prismjs/themes/prism-okaidia.css'

document.addEventListener "turbolinks:load", ->
Prism.highlightAll()
8 changes: 0 additions & 8 deletions web/blog/index.coffee

This file was deleted.

5 changes: 0 additions & 5 deletions web/blog/syntaxHighlighting.coffee

This file was deleted.

5 changes: 3 additions & 2 deletions web/app/App.vue → web/components/App.vue
@@ -1,11 +1,12 @@
<template lang="pug">
#app
navigation
router-view
main
router-view
</template>

<script lang="coffee">
import { Navigation } from './components'
import Navigation from './Navigation'
export default
name: 'app'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion web/app/v-prism.coffee → web/directives/v-prism.coffee
@@ -1,6 +1,6 @@
import Vue from "vue"

import Prism from "../shared/loadPrism"
import Prism from "@/lib/loadPrism"
import 'prismjs/themes/prism-okaidia.css'

Vue.directive "prism",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
import { removeFrom } from '@/helpers'
import { removeFrom } from '@/lib/helpers'

export default
set_posts: (state, posts) ->
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions web/styles/_code.scss
@@ -0,0 +1,9 @@
/* Code snippets */

code {
font-family: "Source Code Pro", "Menlo", "Lucida Console", Monaco, monospace;
font-size: 85%;
border-radius: 5px;

display: inline-block;
}
File renamed without changes.
File renamed without changes.
15 changes: 4 additions & 11 deletions web/app/app.scss → web/styles/app.scss
@@ -1,6 +1,6 @@
@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700");
@import "../shared/mixins";
@import "../shared/box-sizing";
@import "./mixins";
@import "./box-sizing";

$color: #444;
$color-light: #bbb;
Expand Down Expand Up @@ -142,13 +142,6 @@ blockquote {
color: #888;
}

/* Code snippets */

code {
display: inline-block;
padding-left: 0.5em !important;
padding-right: 0.5em !important;
}

/* etc. */
@import "../shared/keys";
@import "./code";
@import "./keys";
15 changes: 4 additions & 11 deletions web/blog/blog.scss → web/styles/blog.scss
Expand Up @@ -2,8 +2,8 @@ $color-background: #fff;
$color-text: #555;
$color-link: rgb(94, 142, 186);

@import "../shared/mixins";
@import "../shared/box-sizing";
@import "./mixins";
@import "./box-sizing";

body {
background-color: $color-background;
Expand Down Expand Up @@ -119,14 +119,6 @@ article.post {
}
}

/* Code Blocks */

code {
font-family: "Source Code Pro", "Lucida Console", Monaco, monospace;
font-size: 90%;
border-radius: 5px;
}

/* Block Quotes */

blockquote {
Expand All @@ -145,4 +137,5 @@ blockquote {
}

/* etc. */
@import "../shared/keys";
@import "./code";
@import "./keys";
6 changes: 3 additions & 3 deletions webpack.config.coffee
Expand Up @@ -59,8 +59,8 @@ plugins = (env, argv) ->

module.exports = (env, argv) ->
entry:
blog: "./web/blog/index.coffee"
app: "./web/app/index.coffee"
blog: "./web/blog.coffee"
app: "./web/app.coffee"

output:
path: __dirname + "/public/assets"
Expand All @@ -73,7 +73,7 @@ module.exports = (env, argv) ->
resolve:
extensions: ["*", ".js", ".coffee", ".vue"]
alias:
"@": path.resolve __dirname, "web/app"
"@": path.resolve __dirname, "web"

plugins: plugins(env, argv)

Expand Down

0 comments on commit 1e70941

Please sign in to comment.