learning grunt.js and I keep getting this error in Terminal.
Running "sass:dist" (sass) task
Warning: Path must be a string. Received undefined Use --force to continue.
Aborted due to warnings.
Here's the code. Any help would be great
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/** Sass task **/
sass: {
dev: {
options: {
style: 'expanded',
sourcemap: 'none',
},
files: {
'compiled/style.css': 'sass/style.scss'
}
},
dist: {
options: {
style: 'compressed',
sourcemap: 'none',
},
files: {
'compiled/style-min.css': 'sass/style-min.scss'
}
}
},
/** Watch task **/
watch: {
css: {
files: '**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['watch']);
}
and here my json
{
"name": "millervolpe2016",
"version": "1.0.0",
"description": "Our company's new theme",
"main": "index.php",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jspraguemillervolpe/miller-volpe.git"
},
"keywords": [
"miller",
"volpe"
],
"author": "Jason Sprague",
"license": "ISC",
"bugs": {
"url": "https://github.com/jspraguemillervolpe/miller-volpe/issues"
},
"homepage": "https://github.com/jspraguemillervolpe/miller-volpe#readme",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-autoprefixer": "^3.0.4",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-watch": "^1.0.0"
},
"dependencies": {}
}
your sass dist: and files: should be like that:
files: {
'compiled/style-min.css': 'sass/style.scss'
}
The file you are pointing is sass/style.scss so you should use the same for dist and dev.
this file: 'sass/style-min.scss' does not exist in your project and in your dev sass you are using: 'sass/style.scss' , I did a test here and now sass:dist works fine if you change this.
let me know if that fix your problem.
thanks.
Related
index.ts
import { Engine } from '#babylonjs/core/Engine/engine';
[tsl] ERROR in ~/Documents/babylon1/src/index.ts(1,24)
TS2307: Cannot find module '#babylonjs/core/Engines/engine'.
I've followed the steps on the Babylon documentation pages, and the troubleshooting notes at https://doc.babylonjs.com/features/npm_support#error-ts2307-cannot-find-module-babylonjs-or-other-modules. I've added "babylonjs" to tscong.json, but I'm still getting the "Cannot find module #babylonjs/core" error.
package.json
"devDependencies": {
"#babylonjs/core": "^4.0.3",
"ts-loader": "^6.2.1",
"typescript": "^3.7.4",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1"
},
"dependencies": {
"babylonjs": "^4.0.3"
}
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist",
"sourceMap": true,
"noImplicitAny": true,
"strictNullChecks": false,
"module": "es6",
"target": "es6",
"types": [
"babylonjs"
]
}
}
I did npm install just to make sure nothing is missing.
The following setup works. The #babylonjs/core/... imports resolve correctly, and webpack-dev-server builds and reloads automatically.
package.json
"devDependencies": {
"#babylonjs/core": "^4.0.3",
"ts-loader": "^6.2.1",
"typescript": "^3.7.4",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1"
},
"dependencies": {}
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist",
"module": "esNext",
"target": "es6",
"moduleResolution": "node"
}
}
NOTE: types: ["babylonjs"] doesn't seem to be necessary
webpack.config.js
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
],
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ],
},
output: {
filename: 'bundle.js'
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
hot: true
}
Below is my code of gruntjs css file is not getting generated even after the scss is compiled successfully with no error
I have tried using the different version and i am using the windows 8
Grunt file:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat:{
js:{
src: 'C:/Local_code/js/*.js',
dest: 'C:/Local_code/src/build.js',
reporterOutput:''
},
css: {
src: 'css/*.css',
dest: 'build/main.css'
}
},
autoprefixer:{
dist:{
files:{
'css/foundation.css':'css/foundation.css'
}
}
},
sass: {
dist: {
options: {
compass: true,
sourceMap:true
},
files: [{
expand: true,
cwd: 'C:/Local-code/Scss/',
src: 'C:/Local-code/Scss/*.scss/',
dest: 'C:/Local-code/build/pratik.css',
ext: '.css'
}]
}
},
postcss: {
options: {
map: true,
map: {
inline: false,
annotation: 'dist/css/maps/'
},
processors: [
require('pixrem')(),
//require('autoprefixer')({browsers: 'last 2 versions'}),
require('cssnano')()
]
},
dist: {
src: 'css/*.css'
}
},
})
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-postcss'); //The “src” folder will hold your unprocessed CSS files, and PostCSS will write your compiled CSS files into the “dest” folder.
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-contrib-watch');
//grunt.registerTask('concat-js', ['concat:js']);
grunt.registerTask('default', ['watch']);
//grunt.registerTask('build', ['autoprefixer']);
};
Package.json
{
"name": "project",
"version": "1.0.0",
"description": "Aem Project",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "pratik",
"license": "ISC",
"dependencies": {
"autoprefixer": "^9.6.1",
"compass": "^0.1.1",
"cssnano": "^4.1.10",
"express": "^4.17.1",
"pixrem": "^5.0.0",
"uglify-js": "github:mishoo/UglifyJS2#harmony"
},
"browserslist": [
"last 1 version",
"> 1%",
"maintained node versions",
"not dead"
],
"devDependencies": {
"grunt": "^1.0.4",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-cssmin": "^3.0.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-uglify-es": "^3.3.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-postcss": "^0.9.0",
"ng-packagr": "^5.3.0",
"uglifyjs-webpack-plugin": "^1.3.0"
}
}
Expected result it should generate the valid css file in destination path.
Actual result css file i not getting generated and no error are coming.
I am new to grunt and I'm having a tough time trying to figure out what I've done wrong.
When I run it I get the error "Unable to compile; no valid source files were found."
If anyone could give me some advice as to how to fix it, I would appreciate it.
Here is my gruntfile:
module.exports = function(grunt) {
grunt.initConfig ({
responsive_images: {
dev: {
options: {
engine: 'im',
sizes: [{
width: 1600,
suffix: '_large_2x',
quality: 30
}]
},
files: [{
expand: true,
src: ['**/*.{gif,jpg,png};'],
cwd: 'images_src/',
dest: 'images/'
}]
}
},
});
grunt.loadNpmTasks('grunt-responsive-images');
grunt.loadNpmTasks('grunt-contrib-imagemin')
grunt.registerTask('default', ['responsive_images']);};
Here is my Package.json
{
"name": "reponsive-images",
"version": "0.1.0",
"repository": {
"type": "git",
"url": "https://github.com/udacity/responsive-images.git"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-imagemin": "^1.0.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.4.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-mkdir": "~0.1.2"
},
"dependencies": {
"grunt-responsive-images": "^0.1.6"
}
}
Any advice you guys can provide would be appreciated!
I solved it!
I needed to edit my src path to: ['/**/*.{gif,jpg,png};],
I'm spending way too much time finding my error. I bet I'm missing a semicolon.
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssbeautifier : {
files : ["css/style.css"],
options : {
indent: ' ',
openbrace: 'end-of-line',
autosemicolon: false
}
}
grunt.loadNpmTasks('grunt-cssbeautifier');
grunt.registerTask('default',["cssbeautifier"]);
})
}
package.json:
{
"name": "zavrsni-php",
"version": "1.0.0",
"description": "Job interview simulator\r Demo: http://interviewsimulator.eu.pn/",
"main": "index.php",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/MarkoIvanetic/zavrsni-PHP.git"
},
"author": "Grad",
"license": "MIT",
"bugs": {
"url": "https://github.com/MarkoIvanetic/zavrsni-PHP/issues"
},
"homepage": "https://github.com/MarkoIvanetic/zavrsni-PHP#readme",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cssbeautifier": "^0.1.2",
"grunt-jsbeautifier": "^0.2.10"
}
}
Fount it, braces on the wrong place
I'm new to bower and grunt and I just started my first project with the below bower dependancies:
bower.json
{
"name": "test",
"version": "0.0.0",
"authors": [
""
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap-rtl": "~0.9.1",
"jquery-ui-bootstrap": "~0.2.5",
"jquery-ui": "~1.10.3",
"jquery": "~2.0.3"
},
"exportsOverride": {
"*": {
"js": "**/*.js",
"css": "**/*.css"
}
}
}
Gruntfile.js
module.exports = function(grunt) {
// Configuration goes here
grunt.initConfig({
bower: {
install: {
options: {
targetDir: './lib',
layout: 'byType',
install: true,
verbose: false,
cleanTargetDir: false,
cleanBowerDir: false,
bowerOptions: {}
}
}
}
//--end
});
// Load plugins here
grunt.loadNpmTasks('grunt-bower-task');
// Define your tasks here
grunt.registerTask('default', ['bower']);
};
I noticed that bower_components/bootstrap-rtl/ contains another Gruntfile.js.
Is there away to call bower_components/bootstrap-rtl/Gruntfile.js from my Gruntfile.js before the bower:install?
You can use --gruntfile to determine the location of the Gruntfile.
Check out the CLI source code for more info.
Example use:
grunt jshint --gruntfile bower_components/bootstrap-rtl/Gruntfile.js
You could also use grunt-grunt, which I just wrote for this kind of scenario.
You configure it like this:
grunt.initConfig({
grunt: {
boots: {
gruntfile: 'bower_components/bootstrap-rtl/Gruntfile.js',
tasks: ['some', 'tasks']
}
}
});
Then you could just set up an alias, such as below:
grunt.registerTask('build', ['grunt:boots', 'compile']);
Hope it works for you.