Skip to content

Commit

Permalink
Added Copy to Grunt for HTML files; updated configuration values
Browse files Browse the repository at this point in the history
  • Loading branch information
nmebrown committed Jan 10, 2021
1 parent 22a6c03 commit 7db23a3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
29 changes: 22 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

// Copy Task
// default: Copies over HTML, static assets to dist
copy: {
default: {
files: [{
expand: true,
flatten: true,
src: 'src/*.html',
dest: 'dist/'
}]
}
},

// sass Task
// default: Convert SCSS to CSS
// dist: Convert SCSS to CSS and compress the output
Expand All @@ -14,12 +27,12 @@ module.exports = function(grunt) {
},
src: {
files: {
'assets/main.css': 'assets/main.scss'
'dist/styles/main.css': 'src/styles/main.scss'
},
},
dist: {
files: {
'assets/main.css': 'assets/main.scss'
'dist/styles/main.css': 'src/styles/main.scss'
},
outputStyle: 'compressed'
}
Expand All @@ -30,7 +43,7 @@ module.exports = function(grunt) {
uglify: {
dist: {
files: {
'assets/main.min.js': 'assets/main.js',
'dist/scripts/main.min.js': 'src/scripts/main.js',
}
}
},
Expand All @@ -41,9 +54,9 @@ module.exports = function(grunt) {
default: {
files: [{
expand: true,
cwd: 'assets/',
cwd: 'src/images/',
src: ['**/*.{png,jpg,gif,ico}'],
dest: 'assets/'
dest: 'dist/images/'
}]
}
},
Expand All @@ -64,9 +77,9 @@ module.exports = function(grunt) {
default: {
files: [{
expand: true,
cwd: 'assets/',
cwd: 'src/images/',
src: ['**/*.svg'],
dest: 'assets/'
dest: 'dist/images/'
}]
}
},
Expand Down Expand Up @@ -98,6 +111,7 @@ module.exports = function(grunt) {
// Compiles the code for the designated distribution target
grunt.registerTask('build', function() {
grunt.task.run([
'newer:copy',
'newer:sass:src',
'newer:uglify',
'newer:imagemin',
Expand All @@ -119,6 +133,7 @@ module.exports = function(grunt) {
// Compiles the code for the designated distribution target
grunt.registerTask('dist', function() {
grunt.task.run([
'copy',
'sass:dist',
'uglify',
'imagemin',
Expand Down
5 changes: 3 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<meta name="description" content="A single page application to support connecting constituents with their elected representatives.">
<meta name="author" content="Cole Brown">

<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="styles/main.css">
<meta name="theme-color" content="">
</head>

Expand Down Expand Up @@ -70,6 +70,7 @@ <h1>Connet with your MP</h1>
<p>Copyright 2021</p>
</footer>

<script src="main.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="scripts/main.min.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions src/styles/core/_grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Layout file

body {
color: #f00;
}
18 changes: 9 additions & 9 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Include Normalize.css to standardize default browser styles
@import '~@csstools/normalize.css';

// Tools
@import './tools/mixins';
@import './tools/functions';
// // Tools
// @import './tools/mixins';
// @import './tools/functions';

// Core
@import './core/grid';
@import './core/typography';
@import './core/forms';
@import './core/button/button';
@import './core/button/button--text';
// // Core
// @import './core/grid';
// @import './core/typography';
// @import './core/forms';
// @import './core/button/button';
// @import './core/button/button--text';

0 comments on commit 7db23a3

Please sign in to comment.