I'm working on a project and I've checked a couple downloads left and right and I can accross Grunt. It's a tool which I would like to use without a doubt.
I've setup a basic Grunt file that enables livereload to work, so whenever I change my .html files, the page is refreshed.
That's all working good. See the snippet below which given you an overview of my current Gruntfile.js
'use strict';
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// The main entry point for the Grunt configuration file.
module.exports = function(grunt) {
// Load all the grunt tasks which are defined in the 'package.json' file.
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Initial grunt configuration.
grunt.initConfig({
// grunt-express configuration.
// Grunt-Express will serve files from the folder listed in the 'bases' property on the specified hostname
// and port.
express: {
all: {
options: {
bases: ['source'],
port: 8080,
hostname: "0.0.0.0",
livereload: true
}
}
},
// grunt-watch configuration.
// Grunt-Watch will monitor the project files.
watch: {
all: {
options: {livereload: true },
files: [
'**/*.html' // Refresh when any HTML file is being updated in any folder.
]
}
},
// grunt-open configuration.
// Grunt-Open will open your browser at the project url's.
open: {
all: {
// The port is loaded dynamically here through the 'express.all.options.port' property.
path: 'http://localhost:<%= express.all.options.port %>'
}
}
});
// Creates the various grunt tasks that needs to be executed.
grunt.registerTask('server', [
'express',
'open',
'watch'
]);
};
Now, in my project I'm using SASS (scss) files and I know that to compile those files I need a plugin called https://github.com/gruntjs/grunt-contrib-sass
In the directory structure of my application I'm having a 'source' folder, and off course I don't want to have 'css' files in there.
So, how can I place a link in my HTML that points to a css file that will be generated by the grunt task?
I'm thinking about compiling the scss files to a temp folder, but in my HTML file, I don't want to put 'temp/...' links. They should be mounted or something else.
Anyone knows how to achieve what I want?
Kind regards