Skip to content

Commit

Permalink
Add the logo to the demo to showcase vite_asset_path
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Jan 24, 2021
1 parent 1155d3b commit c13820e
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 250 deletions.
3 changes: 1 addition & 2 deletions examples/blog/app/frontend/entrypoints/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Turbolinks.start()
ActiveStorage.start()

// Example: Import a stylesheet in app/frontend/styles
import '~/styles/tailwind.css'
import '~/styles/index.css'
import '~/styles/theme.css'

import '~/entrypoints/example_import.js'
import '~/outer_import.js'
3 changes: 0 additions & 3 deletions examples/blog/app/frontend/entrypoints/colored.css

This file was deleted.

1 change: 1 addition & 0 deletions examples/blog/app/frontend/entrypoints/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions examples/blog/app/frontend/entrypoints/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
*, ::after, ::before {
box-sizing: border-box;
}

html {
font-family: ui-sans-serif, system-ui, -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
line-height: 1.5;
}

body {
font-family: inherit;
line-height: inherit;
margin: 0;
}

header {
display: grid;
height: 100vh;
margin: 0 auto;
padding-bottom: 20vh;
place-content: center;
}

.logo {
height: 0;
opacity: 0;
}

.hero {
box-sizing: border-box;
font-size: clamp(4rem, 10vw, 4.5rem);
line-height: 1;
font-weight: 800;
height: 128px;
margin: 0 0 0 1rem;
text-align: center;
}
3 changes: 0 additions & 3 deletions examples/blog/app/frontend/styles/index.css

This file was deleted.

3 changes: 0 additions & 3 deletions examples/blog/app/frontend/styles/tailwind.css

This file was deleted.

21 changes: 21 additions & 0 deletions examples/blog/app/frontend/styles/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.hero > span {
transition: all 0.3s ease;
letter-spacing: -0.025em;
text-shadow: 1px 1px 2px #00000063;
}

.logo {
transition: all 0.3s ease;
opacity: 1;
height: clamp(6rem, 20vw, 8rem);
margin: 0 auto 1.5rem;
}

.rails {
color: #cc0000;
}

.vite {
color: #ffac33;
}

7 changes: 4 additions & 3 deletions examples/blog/app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<header class="h-screen max-w-screen-lg xl:max-w-screen-xl mx-auto grid place-content-center">
<h1 class="hero text-center text-4xl sm:text-6xl lg:text-7xl -mt-32 leading-none font-extrabold tracking-tight">
Vite ⚡️ Rails
<header>
<img class="logo" src="<%= vite_asset_path 'logo.svg' %>"/>
<h1 class="hero">
<span class="vite">Vite</span> <span class="rails">Rails</span>
</h1>
</header>
2 changes: 1 addition & 1 deletion examples/blog/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<%= csp_meta_tag %>
<%= vite_client_tag %>

<%= vite_stylesheet_tag 'styles' %>
<%= vite_javascript_tag 'application' %>
<%= vite_stylesheet_tag 'colored' %>
</head>

<body>
Expand Down
1 change: 0 additions & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"vite-plugin-ruby": "1.0.5",
"postcss": "8.2.4",
"vite": "^2.0.0-beta.46",
"tailwindcss": "^2.0.2",
"webpack-dev-server": "^3.11.2"
}
}
1 change: 0 additions & 1 deletion examples/blog/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
plugins: [
require('tailwindcss'),
require('postcss-import'),
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
Expand Down
Loading

0 comments on commit c13820e

Please sign in to comment.