shootaroo / jit-grunt Goto Github PK
View Code? Open in Web Editor NEWJIT(Just In Time) plugin loader for Grunt.
JIT(Just In Time) plugin loader for Grunt.
jit-grunt seems to have a problem on Ubuntu 14.04.
http://stackoverflow.com/questions/26090936/grunt-install-returns-error-on-ubuntu
I run a 'grunt clean:folder' for testing, with a minimal plugins installed comparing all installed
package.json before
{
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^1.0.0",
"load-grunt-config": "^0.19.2",
"jit-grunt": "^0.10.0",
"time-grunt": "^1.4.0"
}
}
package.json after
{
"devDependencies": {
"autoprefixer": "^8.1.0",
"cssnano": "^3.10.0",
"grunt": "^0.4.5",
"grunt-beep": "^1.0.1",
"grunt-cli": "^0.1.13",
"grunt-concurrent": "^2.3.1",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-compress": "^1.4.1",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-fast-watch": "^0.4.2",
"grunt-notify": "^0.4.5",
"grunt-postcss": "^0.9.0",
"grunt-rename": "^0.1.4",
"grunt-replace": "^1.0.1",
"grunt-svn-export": "^0.1.7",
"grunt-svninfo": "^0.1.6",
"grunt-text-replace": "^0.4.0",
"grunt-version": "^1.2.1",
"grunt-wp-i18n": "^1.0.2",
"jit-grunt": "^0.10.0",
"load-grunt-config": "^0.19.2",
"matchdep": "^1.0.1",
"postcss-object-fit-images": "^1.1.2",
"time-grunt": "^1.4.0"
}
}
With minimal plugins
Execution Time (2018-03-19 08:01:06 UTC)
loading tasks 98ms ██████████████████████████████████████████████ 71%
loading grunt-contrib-clean 33ms ████████████████ 24%
clean:plugins_folder 6ms ███ 4%
Total 139ms
With all plugins
Execution Time (2018-03-19 08:08:14 UTC)
loading tasks 1.8s ██████████████████████████████████████████████████████████████ 96%
loading grunt-contrib-clean 44ms ██ 2%
clean:plugins_folder 23ms █ 1%
Total 1.9s
You can see the loading time is still slow, am I doing it wrong?
my gruntfile.js
module.exports = function(grunt) {
var path = require('path');
require('time-grunt')(grunt);
require('jit-grunt')(grunt);
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'grunt'),
jitGrunt: {
staticMappings: {
replace: 'grunt-text-replace',
makepot: 'grunt-wp-i18n',
}
},
});
};
Update:
Removing "load-grunt-config" reduced the loading time to 8xx ~ 9xx ms, but still 10 times lower than the first case, is it possible to improve it further?
After upgrading to dependencies incl JIT Grunt from v0.5.0
to v0.7.0
, I'm getting the following stack when trying to use assemble.js:
Loading "assemble.js" tasks...ERROR
>> Error: Cannot find module 'globule'
Warning: Task "assemble" failed. Use --force to continue.
Error: Task "assemble" failed.
at Object.jit.taskProxies.(anonymous function).fn (/Users/ain/Documents/projects/.../node_modules/jit-grunt/lib/jit-grunt.js:94:18)
at Object.<anonymous> (/Users/ain/Documents/projects/.../node_modules/grunt/lib/util/task.js:301:30)
at Task.runTaskFn (/Users/ain/Documents/projects/.../node_modules/grunt/lib/util/task.js:251:24)
at Task.<anonymous> (/Users/ain/Documents/projects/.../node_modules/grunt/lib/util/task.js:300:12)
at Task.start (/Users/ain/Documents/projects/.../node_modules/grunt/lib/util/task.js:309:5)
at Object.grunt.tasks (/Users/ain/Documents/projects/.../node_modules/grunt/lib/grunt.js:164:8)
at Object.module.exports [as cli] (/Users/ain/Documents/projects/.../node_modules/grunt/lib/grunt/cli.js:38:9)
at Object.<anonymous> (/Users/ain/.nvm/v0.10.29/lib/node_modules/grunt-cli/bin/grunt:45:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Platform:
node v0.10.29
grunt-cli v0.1.13
grunt v0.4.5
grunt.registerTask("default", ["task:target"]);
Warning: Task "task:target" not found. Use --force to continue.
If I pass a node_modules
folder to jit-grunt with the pluginsRoot
option, jit-grunt should use use the same logic and conventions as grunt.task.loadNpmTasks()
.
If my project is a dependency of another project with an overlapping set of grunt plugins, npm will install those plugins into the parent's node_modules
directory, rather than the node_modules
folder local to my project.
First of all, thanks for such a great tool!
I'm using load-grunt-config
with jit-grunt
to have a base grunt structure (config and tasks) for multiple projects with the ability to override or have specific tasks for individual projects. load-grunt-contrib
has an override parameter for config files but I don't seem to find a way to do something similar in jit-grunt
.
Thanks
Hello! Thank you for the excellent module. It's working great for us.
May I ask why you changed line 5 in 016a88e? It prevents me from loading npm Grunt plugins from a non-standard location. I want to load plugins from this location: node_modules/cf-grunt-config/node_modules/
. (cf-grunt-config is a package we use to store task options that are common to many of our components that we build with Grunt.)
To do this, I was changing Grunt's current working directory prior to requiring jit-grunt, and then changing it back, like so:
// Sets the CWD to the cf-grunt-config package so that jit-grunt looks in the correct place.
grunt.file.setBase('./node_modules/cf-grunt-config/');
// Loads all Grunt tasks in the node_modules directory within the new CWD.
require('jit-grunt')(grunt, {});
// Sets the CWD back to the project root so that the tasks work as expected.
grunt.file.setBase('../../');
With the removal of path.resolve
from line 5, jit-grunt is no longer able to find plugins in that location. Re-inserting that path.resolve
function fixes the issue. Do you mind putting this back in, or is there a specific reason it needed to be removed?
I'd be glad to submit a pull request with the change, if that helps.
Thanks again for developing this!
I've written a grunt plugin under my company's internal npm source, so the grunt plugin' name is: @abc/grunt-xxx
, as the plugin will be installed under node_modules/@abc/grunt-xxx
diretory, I've tried custom static mapping in jit-grunt like this:
require('jit-grunt')(grunt, {
'xxx': '@abc/grunt-xxx'
});
However it still won't work, the console tells that jit-grunt could not find the plugin:
jit-grunt: Plugin for the "xxx" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
So how should I config the plugin? Thank you!
Hi,
here we have the same issue has these guys, I can't install your package anymore via npm, gruntjs/grunt-contrib-imagemin#245
Fix seems simple, in your package.json
"peerDependencies": {
- "grunt": "^0.4.0"
+ "grunt": "~0.4.0"
},
In old npm version, it still work but give these messages:
npm WARN peerDependencies The peer dependency grunt@~0.4.0 included from jit-grunt will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
When defining pluginsRoot, it seems like it is not checking parents' node_modules directory as it should. I do have the latest version.
Here is my situation, that may or may not be covered under the release notes for parent node_modules checking.
I have a common module (say "shared-grunt") that my project depends on. When I have a common dependency (say grunt-contrib-requirejs for my current issue), the jit-grunt is configured inside "shared-grunt" module with pluginsRoot set as absolute path with __dirname. But then, we get error that jit-grunt cannot find a plugin.
Thanks.
I've got this in my Gruntfile.js:
grunt.registerTask('express-keepalive ', 'Keep grunt running', function () { this.async(); });
And getting this warning and build gets failed:
jit-grunt: Plugin for the "express-keepalive" task not found.
No idea what needs to be done to overcome this.
Thanks
This is a bit of an edge case, but
In this scenario:
grunt.registerTask("_taskgroup1", [ "task1", "task2", "task3"]);
grunt.registerTask("taskgroup2", ["_taskgroup1"]);
I get this error:
jit-grunt: Plugin for the "styleguide" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "styleguide" failed. Use --force to continue.
Thanks,
Dan
Hi there, I need to load tasks in grunt-phonegap. However, they register their task names as "phonegap:build", "phonegap:run", "phonegap:release" and "phonegap:debug", etc... I tried to use static mapping as follows:
{
'phonegap:build': 'grunt-phonegap'
...
}
but it doesn't work. Is it because of the colon? But colon is a valid right?
I've been thinking about a way to auto-register static mappings. For instance, grunt-usemin
has 2 tasks: useminPrepare
and usemin
. The first must be registered explicitly with jit-grunt or it won't run. However, when just starting out using your task it's a bit puzzling since the only error you get is "task 'useminPrepare' not found" etc.
I think there are two possible approaches to auto-registering such tasks (none of them ideal, but might be worth the user friendliness)
1. on the first run of jit-grunt caching the dependencies from package.json
and iterating over all grunt-*
modules to see what tasks they register and save that info in a tasks
file. Then whenever jit-grunt is run compare the cached application.json with the real one. With new dependencies add them to the tasks
file.
Benefits:
Cons:
--save
flags, which means very rarely, but therefore even more puzzlingly.2. Maintain a static registry of the most popular tasks yourself and use that as the default plugins
object.
Benefits:
grunt.file.readJSON
on each run for instance)Cons:
I've been trying to come up with different approaches, but can't think of any. AFAIK there's no npm hook that runs whenever a new package is installed, is there?
Do you think one of the above approaches would be worth the effort? If not, I think it would be a good idea to add a warning to the README.md, something like "if a 'task not found' error is thrown, yadda yadda yadda"
How to use custom tasks that are inside a custom folder?
I've added jit-grunt
to my gruntfile and it works just fine however, if I rename one of my grunt tasks:
grunt.renameTask('concat_css', 'concatCss');
The build fails:
>> Cannot rename missing "concat_css" task.
I presume renameTask
is not currently supported?
Currently jit-grunt first checks for grunt-contrib-package
and then for grunt-package
in the node_modules
directory. I have a branch in my project switching from grunt-contrib-sass
to grunt-sass
. When I switch between branches I don't want or need to delete the other version as normally it's not loaded/used etc. However, jit-grunt first checks for grunt-contrib-sass
, executes it & breaks because my config on this branch is targeted at grunt-sass
.
jit-grunt
should first check packages declared in package.json and only if no matching ones are found it should fall back to checking all packages present in node_modules
.
I get a npm warning when I target the latest versions of grunt.. Everything seems to still be working.
npm WARN [email protected] requires a peer of grunt@~0.4.0 but none was installed.
jit-grunt: Plugin for the "—-role=admin" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
Hi,
the task grunt help
doesn't work anymore after switching to jit-grunt
.
I guess other default grunt tasks might be affected as well, since jit-grunt
is not looking for grunt
itself in the plugin directory, not even when setting:
require('jit-grunt')(grunt, { help: 'grunt' });
in the Gruntfile.js
I am seeing really long build times:
devDependencies are: autoprefixer-core, csswring, grunt, grunt-contrib-clean, grunt-contrib-connect, grunt-contrib-imagemin, grunt-contrib-uglify, grunt-contrib-watch, grunt-modernizr, grunt-newer, grunt-postcss, grunt-processhtml, grunt-sass, jit-grunt, time-grunt.
It took me a few moments to understand that grunt.loadNpmTasks()
was made redundant by this, and so I wasn't getting any improvements at all until I removed all calls to that method.
Please document that here, in the readme and example. Thanks =)
I'm not sure if the issue is from jit-grunt
or grunt-contrib-uglify
itself but when I switch to [email protected]
the issue was gone. #307
I'm implementing jit-grunt on a project I just started, and performance with jit-grunt (v0.9.1) is significantly slower than load-grunt-tasks (v1.0.0)
This is executing a multi-task alias, but it does not include all Grunt tasks in this project, so in theory, load-grunt-tasks is loading tasks that aren't being used and is still half a second faster than jit-grunt. Is it just that much faster at loading tasks? Any idea what could be going on?
When trying to install I get the following error:
→ npm install lazyload-grunt --save-dev
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm http GET https://registry.npmjs.org/lazyload-grunt
npm http 404 https://registry.npmjs.org/lazyload-grunt
npm ERR! 404 'lazyload-grunt' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
my grunt file:
module.exports = function (grunt) {
// get my custom cli argument (http://gruntjs.com/api/grunt.option)
var target = grunt.option('target');
require("jit-grunt")(grunt);
grunt.initConfig({
...
});
// My alias task
grunt.registerTask("build", ["clean:build", "copy:build", "uglify:build"]);
}
Without jit-grunt, the following command execute the alias task build
with target
option set to test
grunt build --target=test
With jit-grunt I get the following error:
Loading "GruntFile.js" tasks...ERROR
>> TypeError: undefined is not a function
jit-grunt: Plugin for the "build" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "build" failed. Use --force to continue.
Aborted due to warnings.
when i try npm install -g jit-grunt it exits with the next warn:
npm WARN [email protected] requires a peer of grunt@>=0.4.0 but none was installed.
but grunt is already installed
Good day,
This is my first help cry, cause I am stuck trying to run the Grunt build for my project, this is the error I have:
jit-grunt: Plugin for the "UseminPrepare" task not found.
and this is my Gruntfile:
const { registerTask } = require("grunt");
module.exports =function (grunt){
require('time-grunt')(grunt);
require('jit-grunt')(grunt,{
useminprepare: 'grunt-usemin'
});
grunt.initConfig({
sass: {
dist: {
files: [{
expand: true,
cwd: 'css',
src: ['*.scss'],
dest: 'css',
ext: '.css'
}]
}
},
watch: {
files: ['css/*.scss'],
tasks: ['css']
},
browserSync: {
dev: {
bsFiles: { //browser files
src: [
'css/*.css',
'*.html',
'js/*.js',
]
},
options: {
watchTask: true,
server: {
baseDir: './' //Directorio base para nuestro servidor
}
}
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: './',
src: 'images/*.{png,gif,jpg,jpeg}',
dest: 'dist/'
}]
}
},
copy: {
html: {
files: [{
expand: true,
cwd: './',
src: 'images/*.{png,gif,jpg,jpeg}',
dest: 'dist',
}]
},
},
clean: {
build:{
src: ['dist/']
}
},
uglify: {
dist: {}
},
filerev: {
options: {
encoding: 'utf-8',
algorith: 'md5',
length: 20
},
release: {
// filerev: release hashes(md5) all assets (images, js and css )
// in dist directory
files: [{
src: [
'dist/js*.js',
'dist/css/*.css',
]
}]
}
},
concat: {
options: {
separator: ';'
},
dist: {}
},
useminprepare: {
foo: {
dest: 'dist',
src: ['index.html', 'about.html', 'precios.html', 'contactanos.html', 'Términosycondiciones.html'],
},
options: {
flow: {
steps: {
css: ['cssmin'],
js: ['uglify'],
},
post: {
css: [{
name: 'cssmin',
createConfig: function(context, block){
var generated = context.options.generated;
generated.options ={
keepSpecialComments: 0,
rebase: false
}
}
}]
}
}
}
},
usemin: {
html: ['dist/index.html', 'dist/about.html', 'dist/precios.html', 'dist/contactanos.html', 'dist/Términosycondiciones.html'],
options: {
assetDir: ['dist', 'dist/css', 'dist/js'],
}
}
});
grunt.registerTask('css',['sass']);
grunt.registerTask('default', ['browserSync', 'watch']);
grunt.registerTask('img:compress', ['imagemin']);
grunt.registerTask('build', [
'clean',
'copy',
'imagemin',
'UseminPrepare',
'concat',
'cssmin',
'uglify',
'filerev',
'usemin',
])
};
Please somebody help me
After upgrading from 0.2.3 to 0.3.0, I get the following error:
Warning: string is not a function Use --force to continue.
My configuration is as follows:
require('jit-grunt')(grunt, {
continueOn: 'grunt-continue',
continueOff: 'grunt-continue',
jscs: 'grunt-jscs-checker',
ngtemplates: 'grunt-angular-templates',
protractor: 'grunt-protractor-runner',
useminPrepare: 'grunt-usemin',
});
The current behavior of pluginsRoot
is somewhat confusing, and does not work correctly with absolute paths.
In this case, my working directory is /home/schmod/myProject
, and I've set pluginsRoot
to be /home/schmod/myProject/plugins
. In this case, jit-grunt tries to look for plugins in:
/home/schmod/myProject/home/schmod/myProject/plugins
/home/schmod/home/schmod/myProject/plugins
/home/home/schmod/myProject/plugins
/home/schmod/myProject/plugins
Admittedly, jit-grunt will find the plugin on the last step of this simple example, but we are unable to take advantage of any of the normal "findUp" logic that jit-grunt
supposedly supports (ie. if my plugin is actually in /home/schomd/myProject
).
Given the fact that NPM@3 can produce very....interesting hierarchies of node_modules
trees, it's pretty important for "findUp" to work.
In this example, I'm not going to use an absolute path, but will demonstrate how jit-grunt's pluginsRoot
option doesn't appear to be particularly useful in practice:
If my working directory is /home/schmod/myProject/node_modules/subProject
, and I set `pluginsRoot: 'other/dir', jit-grunt will try to look for plugins in:
/home/schmod/myProject/node_modules/subProject/other/dir
/home/schmod/myProject/node_modules/other/dir
/home/schmod/myProject/other/dir
/home/schmod/other/dir
/home/other/dir
/other/dir
While I understand what's going on here, I'm not sure that this is the behavior that most users will expect or desire -- it's akin to saying "I've set up npm to install packages into a folder that is named something other than node_modules
" -- it's possible, but exceedingly rare.
In this scenario, I would ideally expect jit-grunt to look for plugins in:
/home/schmod/myProject/node_modules/subProject/other/dir
/home/schmod/myProject/node_modules/subProject/other
/home/schmod/myProject/node_modules/subProject
/home/schmod/myProject/node_modules
/home/schmod/myProject
/home/schmod
/home
/
This is my actual use-case.
In this scenario, my working directory is /home/schmod/myProject
, but some of my grunt plugins are actually being provided by a submodule located in /home/schmod/myProject/node_modules/subProject
.
In this scenario, depending on the requirements for myProject
and subProject
, NPM@3 will either install my grunt plugins in /home/schmod/myProject/node_modules
OR /home/schmod/myProject/node_modules/subProject/node_modules
. The current set of configuration options does not allow me to ask jit-grunt to "start searching in ./node_modules/subProject/node_modules
and traverse upwards from there."
Examples 1 and 2 were derived from my attempts to utilize jit-grunt's current functionality to accommodate this use-case.
I suspect that most users will not want/need to set the pluginsRoot
option, but might want to set a cwd
parameter that jit-grunt can use to resolve all paths against, as a "starting" point for the findUp algorithm.
In Example 3 above, I would set cwd: './node_modules/subProject'
, and leave pluginsRoot
with its default value of 'node_modules'
:
require('jit-grunt')(grunt)({
cwd: path.join(process.cwd(), 'node_modules', 'subProject'), // or path.dirname(require.resolve('subProject'))
pluginsRoot: 'node_modules'
});
From there, jit-grunt would traverse my filesystem as follows:
/home/schmod/myProject/node_modules/subProject/node_modules
/home/schmod/myProject/node_modules/node_modules
/home/schmod/myProject/node_modules/
/home/schmod/node_modules/
/home/node_modules
/node_modules
This still isn't ideal, because we're searching a few clearly-nonsensical paths, but we're also a lot less likely to "miss" a plugin.
Additionally, some users might want the option to specify multiple search paths.
I'm trying to use grunt-webpack with jit-grunt.
The grunt-webpack has 2 tasks:
The grunt-webpack
task loads automatically, imported succesfully by jit, however i'm having trouble importing the second task: webpack-dev-server
.
// Automatically load required grunt tasks
require("jit-grunt")(grunt, {
useminPrepare: "grunt-usemin",
webpackDevServer: "grunt-webpack/tasks/webpack-dev-server.js"
});
Any idea what i'm doing wrong, i've not had this problem before importing with jit, but then I've never had to specify a complete path before.
Any help appreciated. Cheers!
These are quite heavily used modules. jit-grunt does not automatically recognize these so I have to map these statically.
Do you know why these aren't recognized automatically?
Hello, and thanks for your great plugin.
It would be very pleasant to have the hability to disable messages like this one :
Loading "grunt-sass" plugin
>> Plugin loaded.
Maybe a debugInfo
or silentMode
should do it.
Have a nice day !
README.md
& jit-grunt.js
files have the executable bit turned on. For README it doesn't make any sense at all and as for jit-grunt.js
, node fires it by itself when using require
so it's not needed either.
Hi @shootaroo I've had good luck with this plugin in the past (thanks!) but am having a weird interaction with grunt-sass on current project.
// Load Grunt modules
// require('load-grunt-tasks')(grunt);
require('jit-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'expanded'
},
files: {
'dist/css/main.css': 'sass/main.scss',
}
}
},
(not an open-source project, but if you need the rest of the Gruntfile, I can anonymize)
When I use jit-grunt, loading tasks is blazing fast, but grunt-sass is slow (50ms and 3s respectively). When I use load-grunt-tasks, loading tasks is slow but grunt-sass is much faster (1.6s and 200ms).
Any idea why this is happening?
Still can`t get this https://github.com/shootaroo/jit-grunt#static-mappings and it is precisely with grunt-spritesmith task. My sprite task:
sprite:{
all: {
src: 'src/images/sprites/*.png',
destImg: 'src/images/sprites.png',
destCSS: 'src/less/inc/sprites.less',
algorithm: 'binary-tree',
padding: 2
}
},
Hello I receiving the next error and I have no idea how to resolve it:
jit-grunt: Plugin for the "default" task not found. If you have installed the plugin already, please setting the static mapping.
This is my gruntfile:
`// Generated on 2017-03-24 using generator-angular 0.16.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,/}.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Automatically load required Grunt tasks
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn'
});
// Configurable paths for the application
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'dist'
};
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
yeoman: appConfig,
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['newer:jshint:all', 'newer:jscs:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'postcss:server']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect().use(
'/app/styles',
connect.static('./app/styles')
),
connect.static(appConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
// Make sure there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
// Make sure code styles are up to par
jscs: {
options: {
config: '.jscsrc'
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
src: ['test/spec/{,*/}*.js']
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
postcss: {
options: {
processors: [
require('autoprefixer-core')({
browsers: ['last 1 version']
})
]
},
server: {
options: {
map: true
},
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes: {
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
},
sass: {
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}bower_components\//
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
sourcemap: true
}
}
},
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/images',
'<%= yeoman.dist %>/styles'
],
patterns: {
js: [
[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']
]
}
}
},
// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
ngtemplates: {
dist: {
options: {
module: 'angJsTutApp',
htmlmin: '<%= htmlmin.dist.options %>',
usemin: 'scripts/scripts.js'
},
cwd: '<%= yeoman.app %>',
src: 'views/{,*/}*.html',
dest: '.tmp/templateCache.js'
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}, {
expand: true,
cwd: 'bower_components/bootstrap/dist',
src: 'fonts/*',
dest: '<%= yeoman.dist %>'
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'compass:server'
],
test: [
'compass'
],
dist: [
'compass:dist',
'imagemin',
'svgmin'
]
},
// Test settings
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'postcss:server',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
grunt.log.warn('The server
task has been deprecated. Use grunt serve
to start a server.');
grunt.task.run(['serve:' + target]);
});
grunt.registerTask('test', [
'clean:server',
'wiredep',
'concurrent:test',
'postcss',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'postcss',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'newer:jscs',
'test',
'build'
]);
};
`
I'm not entirely sure the best way to explain the issue that I ran into, but basically we are using a grunt config with an empty target for grunt-composer and it fails using jit-grunt. Deleting the file entirely fixes the issue, but I thought it might warrant some investigation.
Here's a link to the issue we ran into: https://github.com/FlagshipWP/compass/issues/18
If there's anything else I can do to help explain/reproduce the problem please let me know.
I am using grunt-bump v0.8.0 with jit-grunt v0.10.0 & grunt 1.0.1 and getting an error for bump-only and bump-commit. bump by itself works fine.
gruntfile.js
require('jit-grunt')(grunt)({
'bump-only': 'grunt-bump',
'bump-commit': 'grunt-bump',
customTasksDir: 'grunt-tasks'
});
Error is
jit-grunt: Plugin for the "bump-only" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "bump-only" failed. Use --force to continue.
I have tried several variations of the static mappings but everyone results in the same error. I am using the example grunt-bump configuration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.