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

Commit 331a56f

Browse files
author
drgomesp
committed
First commit (working bootstrap 4, scss, gulp, browsersync and more goodies)
1 parent 426e15d commit 331a56f

22 files changed

+6891
-88
lines changed

.docker/nginx/conf/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ events {
1010

1111
http {
1212
server_tokens off;
13-
sendfile on;
13+
sendfile off;
1414
tcp_nopush on;
1515
tcp_nodelay on;
1616
keepalive_timeout 15;

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@
1515
!var/SymfonyRequirements.php
1616
/vendor/
1717
/web/bundles/
18+
/web/css/
19+
/web/js/
20+
/node_modules/
21+
npm-debug.log

app/Resources/views/base.html.twig

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="UTF-8" />
5-
<title>{% block title %}Welcome!{% endblock %}</title>
6-
{% block stylesheets %}{% endblock %}
7-
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
8-
</head>
9-
<body>
10-
{% block body %}{% endblock %}
11-
{% block javascripts %}{% endblock %}
12-
</body>
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<title>{% block title %}Welcome!{% endblock %}</title>
6+
{% block stylesheets %}{% endblock %}
7+
<link href="https://fonts.googleapis.com/css?family=Montserrat:500" rel="stylesheet">
8+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
9+
10+
<link rel="stylesheet" type="text/css" href="{{ asset('css/main.min.css') }}">
11+
</head>
12+
<body>
13+
{% include 'default/nav.html.twig' %}
14+
{% block body %}{% endblock %}
15+
{% block javascripts %}{% endblock %}
16+
<script src="{{ asset('js/main.min.js') }}" type="text/javascript"></script>
17+
</body>
1318
</html>
Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,7 @@
11
{% extends 'base.html.twig' %}
22

33
{% block body %}
4-
<div id="wrapper">
5-
<div id="container">
6-
<div id="welcome">
7-
<h1><span>Welcome to</span> Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }}</h1>
8-
</div>
9-
10-
<div id="status">
11-
<p>
12-
<svg id="icon-status" width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z" fill="#759E1A"/></svg>
13-
14-
Your application is ready to start working on it at:
15-
<code>{{ base_dir }}/</code>
16-
</p>
17-
</div>
18-
19-
<div id="next">
20-
<h2>What's next?</h2>
21-
<p>
22-
<svg id="icon-book" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="-12.5 9 64 64" enable-background="new -12.5 9 64 64" xml:space="preserve">
23-
<path fill="#AAA" d="M6.8,40.8c2.4,0.8,4.5-0.7,4.9-2.5c0.2-1.2-0.3-2.1-1.3-3.2l-0.8-0.8c-0.4-0.5-0.6-1.3-0.2-1.9
24-
c0.4-0.5,0.9-0.8,1.8-0.5c1.3,0.4,1.9,1.3,2.9,2.2c-0.4,1.4-0.7,2.9-0.9,4.2l-0.2,1c-0.7,4-1.3,6.2-2.7,7.5
25-
c-0.3,0.3-0.7,0.5-1.3,0.6c-0.3,0-0.4-0.3-0.4-0.3c0-0.3,0.2-0.3,0.3-0.4c0.2-0.1,0.5-0.3,0.4-0.8c0-0.7-0.6-1.3-1.3-1.3
26-
c-0.6,0-1.4,0.6-1.4,1.7s1,1.9,2.4,1.8c0.8,0,2.5-0.3,4.2-2.5c2-2.5,2.5-5.4,2.9-7.4l0.5-2.8c0.3,0,0.5,0.1,0.8,0.1
27-
c2.4,0.1,3.7-1.3,3.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/{{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION')[:3] }}/book/page_creation.html">
40-
How to create your first page in Symfony
41-
</a>
42-
</p>
43-
</div>
44-
45-
</div>
46-
</div>
474
{% endblock %}
485

496
{% block stylesheets %}
50-
<style>
51-
body { background: #F5F5F5; font: 18px/1.5 sans-serif; }
52-
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
53-
h1 { font-size: 36px; }
54-
h2 { font-size: 21px; margin-bottom: 1em; }
55-
p { margin: 0 0 1em 0; }
56-
a { color: #0000F0; }
57-
a:hover { text-decoration: none; }
58-
code { background: #F5F5F5; max-width: 100px; padding: 2px 6px; word-wrap: break-word; }
59-
#wrapper { background: #FFF; margin: 1em auto; max-width: 800px; width: 95%; }
60-
#container { padding: 2em; }
61-
#welcome, #status { margin-bottom: 2em; }
62-
#welcome h1 span { display: block; font-size: 75%; }
63-
#icon-status, #icon-book { float: left; height: 64px; margin-right: 1em; margin-top: -4px; width: 64px; }
64-
#icon-book { display: none; }
65-
66-
@media (min-width: 768px) {
67-
#wrapper { width: 80%; margin: 2em auto; }
68-
#icon-book { display: inline-block; }
69-
#status a, #next a { display: block; }
70-
71-
@-webkit-keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
72-
@keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
73-
.sf-toolbar { opacity: 0; -webkit-animation: fade-in 1s .2s forwards; animation: fade-in 1s .2s forwards;}
74-
}
75-
</style>
767
{% endblock %}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<nav class="navbar navbar-toggleable-md navbar-light navbar-inverse bg-primary">
2+
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
3+
data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
4+
aria-label="Toggle navigation">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
<a class="navbar-brand" href="#"><i class="fa fa-bullhorn fa-1x" aria-hidden="true"></i> shakawa</a>
8+
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
9+
<div class="navbar-nav">
10+
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
11+
<a class="nav-item nav-link" href="#">Features</a>
12+
<a class="nav-item nav-link" href="#">Pricing</a>
13+
<a class="nav-item nav-link disabled" href="#">Disabled</a>
14+
</div>
15+
</div>
16+
</nav>

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ services:
1616
volumes_from:
1717
- app
1818
ports:
19-
- "80:80"
19+
- "81:80"

gulpfile.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
'use strict';
2+
3+
const del = require('del');
4+
const gulp = require('gulp');
5+
const sass = require('gulp-sass');
6+
const cssmin = require('gulp-cssmin');
7+
const concat = require('gulp-concat');
8+
const uglify = require('gulp-uglify');
9+
const BrowserSync = require('browser-sync');
10+
11+
const browserSync = BrowserSync.create();
12+
13+
const paths = {
14+
clean: [],
15+
templates: [],
16+
styles: {
17+
sources: [
18+
'node_modules/font-awesome/scss/*.scss',
19+
'node_modules/bootstrap/scss/*.scss',
20+
'web/scss/**/*.scss',
21+
],
22+
concat: 'main.min.css',
23+
dest: 'web/css'
24+
},
25+
scripts: {
26+
sources: [
27+
'node_modules/tether/dist/js/tether.js',
28+
'node_modules/jquery/dist/jquery.min.js',
29+
'node_modules/bootstrap/dist/js/bootstrap.min.js',
30+
],
31+
concat: 'main.min.js',
32+
dest: 'web/js'
33+
}
34+
};
35+
36+
function clean() {
37+
return del(paths.clean);
38+
}
39+
40+
function styles() {
41+
return gulp.src(paths.styles.sources)
42+
.pipe(sass())
43+
.pipe(cssmin())
44+
.pipe(concat(paths.styles.concat))
45+
.pipe(gulp.dest(paths.styles.dest))
46+
.pipe(browserSync.stream())
47+
}
48+
49+
function scripts() {
50+
return gulp.src(paths.scripts.sources)
51+
.pipe(uglify())
52+
.pipe(concat(paths.scripts.concat))
53+
.pipe(gulp.dest(paths.scripts.dest))
54+
.pipe(browserSync.stream());
55+
}
56+
57+
function serve() {
58+
browserSync.init({
59+
proxy: 'symfony-docker.dev:81',
60+
open: false,
61+
});
62+
}
63+
64+
function watch() {
65+
gulp.watch(paths.styles.sources, styles);
66+
gulp.watch(paths.scripts.sources, scripts);
67+
gulp.watch(paths.templates).on('change', browserSync.reload);
68+
}
69+
70+
const build = gulp.series(
71+
clean,
72+
gulp.parallel(
73+
styles,
74+
scripts
75+
)
76+
);
77+
78+
const dev = gulp.series(
79+
build,
80+
gulp.parallel(
81+
serve,
82+
watch
83+
)
84+
);
85+
86+
gulp.task('build', build);
87+
gulp.task('default', dev);

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"scripts": {
3+
"build": "gulp build",
4+
"dev": "gulp"
5+
},
6+
"dependencies": {
7+
"bootstrap": "4.0.0-alpha.6",
8+
"font-awesome": "^4.7.0"
9+
},
10+
"devDependencies": {
11+
"browser-sync": "^2.18.8",
12+
"del": "^2.2.2",
13+
"gulp": "github:gulpjs/gulp#4.0",
14+
"gulp-concat": "^2.6.1",
15+
"gulp-cssmin": "^0.1.7",
16+
"gulp-sass": "^3.1.0",
17+
"gulp-uglify": "^2.1.2"
18+
}
19+
}

src/AppBundle/Controller/DefaultController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class DefaultController extends Controller
1414
public function indexAction(Request $request)
1515
{
1616
// replace this example code with whatever you need
17-
return $this->render('default/index.html.twig', [
18-
'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'),
19-
]);
17+
return $this->render('default/index.html.twig');
2018
}
2119
}

web/apple-touch-icon.png

-10.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)