Skip to content

Commit fc14be2

Browse files
refactored common blog post css in separate file
1 parent aecaa08 commit fc14be2

5 files changed

Lines changed: 92 additions & 149 deletions

File tree

build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ buildscript {
66
includeVersionByRegex 'org[.]apache[.]((grails)|(groovy)).*', '.*', '.*-SNAPSHOT'
77
}
88
}
9+
maven {
10+
url = 'https://central.sonatype.com/repository/maven-snapshots'
11+
content {
12+
includeVersionByRegex 'cloud[.]wondrify', '.*', '.*-SNAPSHOT'
13+
}
14+
}
915
maven { url = 'https://repo.grails.org/grails/restricted' }
1016
}
1117
dependencies {
1218
classpath platform("org.apache.grails:grails-bom:$grailsVersion")
13-
classpath "org.apache.grails:grails-gradle-plugins"
19+
classpath 'org.apache.grails:grails-gradle-plugins'
1420
classpath 'org.apache.grails.gradle:grails-publish'
21+
classpath 'cloud.wondrify:asset-pipeline-gradle'
1522
}
1623
}
1724

example/build.gradle

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ plugins {
66

77
apply plugin: "org.apache.grails.gradle.grails-web"
88
apply plugin: "org.apache.grails.gradle.grails-gsp"
9+
apply plugin: 'cloud.wondrify.asset-pipeline'
10+
11+
assets {
12+
minifyJs = true
13+
minifyCss = true
14+
}
915

1016
configurations {
1117
developmentOnly
@@ -45,10 +51,13 @@ dependencies {
4551
implementation "org.apache.grails:grails-data-hibernate5"
4652

4753
// H2 Database
48-
runtimeOnly("com.h2database:h2")
54+
runtimeOnly "com.h2database:h2"
55+
56+
// asset pipeline
57+
runtimeOnly "cloud.wondrify:asset-pipeline-grails"
4958
}
5059

5160
// https://github.com/apache/grails-core/issues/15321
5261
tasks.withType(GroovyCompile).configureEach {
5362
groovyOptions.optimizationOptions.indy = false
54-
}
63+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.editor-container {
2+
display: grid;
3+
grid-template-columns: 1fr 1fr;
4+
gap: 1.5rem;
5+
}
6+
7+
@media (max-width: 768px) {
8+
.editor-container {
9+
grid-template-columns: 1fr;
10+
}
11+
}
12+
13+
.editor-pane {
14+
display: flex;
15+
flex-direction: column;
16+
height: 100%;
17+
}
18+
19+
.editor-pane .form-group {
20+
flex: 1;
21+
display: flex;
22+
flex-direction: column;
23+
}
24+
25+
.editor-pane textarea {
26+
flex: 1;
27+
width: 100%;
28+
box-sizing: border-box;
29+
min-height: 500px;
30+
height: 500px;
31+
resize: vertical;
32+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
33+
font-size: 14px;
34+
line-height: 1.6;
35+
padding: 1rem;
36+
border: 1px solid #ddd;
37+
border-radius: 8px;
38+
background: #fafafa;
39+
}
40+
41+
.preview-pane {
42+
background: white;
43+
padding: 1.5rem;
44+
border-radius: 8px;
45+
border: 1px solid #ddd;
46+
min-height: 500px;
47+
height: 500px;
48+
overflow-y: auto;
49+
display: flex;
50+
flex-direction: column;
51+
}
52+
53+
.preview-pane h3 {
54+
margin-top: 0;
55+
color: #2c3e50;
56+
border-bottom: 2px solid #3498db;
57+
padding-bottom: 0.5rem;
58+
margin-bottom: 1rem;
59+
flex-shrink: 0;
60+
}
61+
62+
.preview-content {
63+
flex: 1;
64+
overflow-y: auto;
65+
}
66+
67+
.help-text {
68+
font-size: 0.9rem;
69+
color: #7f8c8d;
70+
margin-top: 0.5rem;
71+
}

example/grails-app/views/blogPost/create.gsp

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,7 @@
33
<head>
44
<meta name="layout" content="main"/>
55
<title>Create New Blog Post</title>
6-
<style>
7-
.editor-container {
8-
display: grid;
9-
grid-template-columns: 1fr 1fr;
10-
gap: 1.5rem;
11-
}
12-
13-
@media (max-width: 768px) {
14-
.editor-container {
15-
grid-template-columns: 1fr;
16-
}
17-
}
18-
19-
.editor-pane {
20-
display: flex;
21-
flex-direction: column;
22-
height: 100%;
23-
}
24-
25-
.editor-pane .form-group {
26-
flex: 1;
27-
display: flex;
28-
flex-direction: column;
29-
}
30-
31-
.editor-pane textarea {
32-
flex: 1;
33-
width: 100%;
34-
box-sizing: border-box;
35-
min-height: 500px;
36-
height: 500px;
37-
resize: vertical;
38-
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
39-
font-size: 14px;
40-
line-height: 1.6;
41-
padding: 1rem;
42-
border: 1px solid #ddd;
43-
border-radius: 8px;
44-
background: #fafafa;
45-
}
46-
47-
.preview-pane {
48-
background: white;
49-
padding: 1.5rem;
50-
border-radius: 8px;
51-
border: 1px solid #ddd;
52-
min-height: 500px;
53-
height: 500px;
54-
overflow-y: auto;
55-
display: flex;
56-
flex-direction: column;
57-
}
58-
59-
.preview-pane h3 {
60-
margin-top: 0;
61-
color: #2c3e50;
62-
border-bottom: 2px solid #3498db;
63-
padding-bottom: 0.5rem;
64-
margin-bottom: 1rem;
65-
flex-shrink: 0;
66-
}
67-
68-
.preview-content {
69-
flex: 1;
70-
overflow-y: auto;
71-
}
72-
73-
.help-text {
74-
font-size: 0.9rem;
75-
color: #7f8c8d;
76-
margin-top: 0.5rem;
77-
}
78-
</style>
6+
<asset:stylesheet src="blogPost.css"/>
797
</head>
808
<body>
819
<div class="card">

example/grails-app/views/blogPost/edit.gsp

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,7 @@
33
<head>
44
<meta name="layout" content="main"/>
55
<title>Edit: ${blogPost?.title}</title>
6-
<style>
7-
.editor-container {
8-
display: grid;
9-
grid-template-columns: 1fr 1fr;
10-
gap: 1.5rem;
11-
}
12-
13-
@media (max-width: 768px) {
14-
.editor-container {
15-
grid-template-columns: 1fr;
16-
}
17-
}
18-
19-
.editor-pane {
20-
display: flex;
21-
flex-direction: column;
22-
height: 100%;
23-
}
24-
25-
.editor-pane .form-group {
26-
flex: 1;
27-
display: flex;
28-
flex-direction: column;
29-
}
30-
31-
.editor-pane textarea {
32-
flex: 1;
33-
width: 100%;
34-
box-sizing: border-box;
35-
min-height: 500px;
36-
height: 500px;
37-
resize: vertical;
38-
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
39-
font-size: 14px;
40-
line-height: 1.6;
41-
padding: 1rem;
42-
border: 1px solid #ddd;
43-
border-radius: 8px;
44-
background: #fafafa;
45-
}
46-
47-
.preview-pane {
48-
background: white;
49-
padding: 1.5rem;
50-
border-radius: 8px;
51-
border: 1px solid #ddd;
52-
min-height: 500px;
53-
height: 500px;
54-
overflow-y: auto;
55-
display: flex;
56-
flex-direction: column;
57-
}
58-
59-
.preview-pane h3 {
60-
margin-top: 0;
61-
color: #2c3e50;
62-
border-bottom: 2px solid #3498db;
63-
padding-bottom: 0.5rem;
64-
margin-bottom: 1rem;
65-
flex-shrink: 0;
66-
}
67-
68-
.preview-content {
69-
flex: 1;
70-
overflow-y: auto;
71-
}
72-
73-
.help-text {
74-
font-size: 0.9rem;
75-
color: #7f8c8d;
76-
margin-top: 0.5rem;
77-
}
78-
</style>
6+
<asset:stylesheet src="blogPost.css"/>
797
</head>
808
<body>
819
<div class="card">

0 commit comments

Comments
 (0)