चलाते समय काम नहीं कर रहा है मैंने "यो वेबपैप" का उपयोग करके अपनी संरचना बनाने के लिए यमन का उपयोग किया, मैंने एनएमपी के माध्यम से इंस्टॉलेशन प्रक्रिया के दौरान सभी एक्स्ट्रा को बाहर रखा और मैन्युअल रूप से बूटस्ट्रैप फ़ाइलों को डाउनलोड किया।Gruntfile grunt build कमांड
मैं "ग्रंट बिल्ड" कमांड चलाने की कोशिश कर रहा हूं जो ऐप फ़ोल्डर (और इसके उप फ़ोल्डरों और उनके उप फ़ोल्डर, आदि) में सब कुछ लेना चाहिए और फाइलों को एक दूरस्थ फ़ोल्डर में बनाना, संकलित करना, संक्षिप्त करना और छोटा करना चाहिए मूल निर्देशिका (ऐप के समान स्तर पर), क्योंकि मुझे यकीन है कि जिसने योनि और ग्रंट का उपयोग किया है, उसे पता है।
किसी कारण से यह ऐसा नहीं करेगा हालांकि मैंने इसे काम करने की कोशिश करने के लिए gruntfile में डिफ़ॉल्ट पथ, आदि इत्यादि बदलने की कोशिश की है, लेकिन यह सही ढंग से काम नहीं कर रहा है (ईमानदार होने के लिए, यह कह रहा है कि यह ' टी काम बिल्कुल अधिक उपयुक्त है, भले ही यह cmd में कहता है कि यह करता है)।
यह अब cmd के अनुसार निर्माण कार्य पूरा करता है (यह पहले नहीं था, दावा किया कि छवि के कार्य के साथ कोई समस्या थी, लेकिन मैंने इसे बदल दिया और यह अब काम करता है (या तो यह कहता है)), लेकिन जब मैं देखता हूं dist फ़ोल्डर में, केवल एक index.html और एक शैलियों फ़ाइल है (जिसमें कुछ सीएसएस फ़ाइलों को शामिल नहीं किया जाना चाहिए ...)।
Site
├───.tmp
│ ├───spec
│ └───styles
├───app
├───fonts
├───images
│ ├───home
│ ├───payments
│ └───profile
├───scripts
│ ├───JS
│ ├───PHP
└───styles
.tmp फ़ोल्डर स्वचालित रूप से किसी कारण से बनाई गई है, मैं के बाद से यह जब मैं अनुप्रयोग में फ़ाइलों को सहेजने किया जाता है कुछ के साथ घुरघुराना मदद करने के लिए मान लेते हैं:
यहाँ मेरी फ़ोल्डर संरचना का महत्वपूर्ण हिस्सा है फ़ोल्डर और grunt देख रहा है।
सभी मैं चाहता हूँ सरल है:
- "घुरघुराना निर्माण" चलाने के लिए सक्षम होने के लिए
- तो घुरघुराना सभी फ़ोल्डर और फ़ाइलें
- के माध्यम से जाना, जोड़, संशोधित करने, पुन: बनाने, ले जाने के लिए है और करने के लिए अपेक्षा के अनुरूप फ़ाइलों को बनाने के (यदि आप Yeoman और घुरघुराना एक साथ इस्तेमाल किया है, तो आप को पता चल जाएगा कि मैं क्या मतलब है और उम्मीद करते हैं, अधिक जिसे उपयुक्त) उत्पादन करने के लिए
- जिले फ़ोल्डर
यदि यह मदद करता है, तो फ़ोल्डरों में फ़ाइल प्रकार आप अपेक्षा करते हैं, फ़ॉन्ट फ़ोल्डर में [ईओटी, टीटीएफ, ओटीएफ, डब्ल्यूओएफएफ, एसवीजी], छवियां और इसके उप फ़ोल्डर्स [पीएनजी, जेपीईजी, जीआईएफ] का उपयोग करते हैं, स्क्रिप्ट्स [ जेएस, पीएचपी] अपने और उसके उप फ़ोल्डरों और शैलियों में [एसएएसएस, एससीएसएस, सीएसएस] है, लेकिन जाहिर है कि यह सिर्फ सीएसएस है जिसे मैं दूर करने के बारे में सोचता हूं।
इससे आपके दिमाग में जटिल हो सकता है लेकिन उम्मीद है कि आप जानते हैं कि मैं आपसे पहले काम करने और गड़बड़ी करने के बाद क्या उम्मीद करता हूं और मुझे कार्य और आंदोलन करने में मदद कर सकता है।
यहाँ मेरी gruntfile है, क्योंकि यह खड़ा है:
// Generated on 2015-11-17 using
// generator-webapp 1.1.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// If you want to recursively match all subfolders, use:
// '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'
});
// Configurable paths
var config = {
app: 'app',
dist: 'dist'
};
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
config: config,
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
babel: {
files: ['<%= config.app %>/scripts/{,*/}*.js'],
tasks: ['babel:dist']
},
babelTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['babel:test', 'test:watch']
},
gruntfile: {
files: ['Gruntfile.js']
},
styles: {
files: ['<%= config.app %>/styles/{,*/}*.css'],
tasks: ['newer:copy:styles', 'postcss']
}
},
browserSync: {
options: {
notify: false,
background: true,
watchOptions: {
ignored: ''
}
},
livereload: {
options: {
files: [
'<%= config.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= config.app %>/images/{,*/}*',
'.tmp/scripts/{,*/}*.js'
],
port: 9000,
server: {
baseDir: ['.tmp', config.app],
routes: {
'/bower_components': './bower_components'
}
}
}
},
test: {
options: {
port: 9001,
open: false,
logLevel: 'silent',
host: 'localhost',
server: {
baseDir: ['.tmp', './test', config.app],
routes: {
'/bower_components': './bower_components'
}
}
}
},
dist: {
options: {
background: false,
server: '<%= config.dist %>'
}
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= config.dist %>/*',
'!<%= config.dist %>/.git*'
]
}]
},
server: '.tmp'
},
// Make sure code styles are up to par and there are no obvious mistakes
eslint: {
target: [
'Gruntfile.js',
'<%= config.app %>/scripts/{,*/}*.js',
'!<%= config.app %>/scripts/vendor/*',
'test/spec/{,*/}*.js'
]
},
// Mocha testing framework configuration options
mocha: {
all: {
options: {
run: true,
urls: ['http://<%= browserSync.test.options.host %>:<%= browserSync.test.options.port %>/index.html']
}
}
},
// Compiles ES6 with Babel
babel: {
options: {
sourceMap: true
},
dist: {
files: [{
expand: true,
cwd: '<%= config.app %>/scripts/*',
src: '{,*/}*.js',
dest: '.tmp/scripts',
ext: '.js'
}]
},
test: {
files: [{
expand: true,
cwd: 'test/spec',
src: '{,*/}*.js',
dest: '.tmp/spec',
ext: '.js'
}]
}
},
postcss: {
options: {
map: true,
processors: [
// Add vendor prefixed styles
require('autoprefixer')({
browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']
})
]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the HTML file
wiredep: {
app: {
src: ['<%= config.app %>/index.html'],
ignorePath: /^(\.\.\/)*\.\./
}
},
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= config.dist %>/scripts/{,*/}*.js',
'<%= config.dist %>/styles/{,*/}*.css',
'<%= config.dist %>/images/{,*/}*.*',
'<%= config.dist %>/styles/fonts/{,*/}*.*',
'<%= config.dist %>/*.{ico,png}'
]
}
},
// 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: {
options: {
dest: '<%= config.dist %>'
},
html: '<%= config.app %>/index.html'
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
options: {
assetsDirs: [
'<%= config.dist %>',
'<%= config.dist %>/images',
'<%= config.dist %>/styles'
]
},
html: ['<%= config.dist %>/{,*/}*.html'],
css: ['<%= config.dist %>/styles/{,*/}*.css']
},
// The following *-min tasks produce minified files in the dist folder
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= config.app %>/images/*',
src: '{,*/}*.*',
dest: '<%= config.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= config.app %>/images',
src: '{,*/}*.svg',
dest: '<%= config.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
conservativeCollapse: true,
removeAttributeQuotes: true,
removeCommentsFromCDATA: true,
removeEmptyAttributes: true,
removeOptionalTags: true,
// true would impact styles with attribute selectors
removeRedundantAttributes: false,
useShortDoctype: true
},
files: [{
expand: true,
cwd: '<%= config.dist %>',
src: '{,*/}*.html',
dest: '<%= config.dist %>'
}]
}
},
cssmin: {
dist: {
files: {
'<%= config.dist %>/styles/main.css': [
'.tmp/styles/{,*/}*.css',
'<%= config.app %>/styles/{,*/}*.css'
]
}
}
},
uglify: {
dist: {
files: {
'<%= config.dist %>/scripts/scripts.js': [
'<%= config.dist %>/scripts/scripts.js'
]
}
}
},
concat: {
dist: {}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
dest: '<%= config.dist %>',
src: [
'*.{ico,png,txt}',
'images/{,*/}*.webp',
'{,*/}*.html',
'styles/fonts/{,*/}*.*'
]
}]
},
styles: {
expand: true,
dot: true,
cwd: '<%= config.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up build process
concurrent: {
server: [
'babel:dist',
'copy:styles'
],
test: [
'babel',
'copy:styles'
],
dist: [
'babel',
'copy:styles',
'imagemin',
'svgmin'
]
}
});
grunt.registerTask('serve', 'start the server and preview your app', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'browserSync:dist']);
}
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'postcss',
'browserSync:livereload',
'watch'
]);
});
grunt.registerTask('server', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run([target ? ('serve:' + target) : 'serve']);
});
grunt.registerTask('test', function (target) {
if (target !== 'watch') {
grunt.task.run([
'clean:server',
'concurrent:test',
'postcss'
]);
}
grunt.task.run([
'browserSync:test',
'mocha'
]);
});
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'postcss',
'concat',
'cssmin',
'uglify',
'copy:dist',
'filerev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:eslint',
'test',
'build'
]);
};
मैं स्क्रीनशॉट आप इस समस्या को दिखाने के लिए ले जाएगा, लेकिन जैसा कि मैंने कहा, जब मैं "घुरघुराना निर्माण" चलाने के लिए, यह अध्यक्ष एवं प्रबंध निदेशक के अनुसार गुजरता है लेकिन ऐसा नहीं करता जैसा कि मैंने समझाया, वास्तव में क्या अपेक्षा की जाती है।
यदि आपको कोई स्पष्टीकरण की आवश्यकता है, तो मुझे बताएं।
चीयर्स,
- एसडी
कुछ प्रश्न: 1. "मैंने यो वेबपैड का उपयोग करके अपनी संरचना बनाने के लिए यमन का इस्तेमाल किया"। तो क्या आपको एक परियोजना शुरू करने में समस्याएं आ रही हैं? 2. जब आप गड़बड़ी करते हैं, तो क्या आपको कोई त्रुटि संदेश मिलता है? – Jodevan
आईडी आपको सलाह देता है कि आप नोड और संबंधित पैकेज (यमन आदि) को पुनर्स्थापित करें – ihaveitnow
@ जोदेवन 1) नहीं, नहीं, मेरे पास एक प्रोजेक्ट है जो शुरू हुआ है, मैं केवल यह समझा रहा था कि मैंने शुरुआत में प्रोजेक्ट कैसे बनाया है क्योंकि आपने एक अलग गंटफाइल आश्रित बनाया है आपके जनरेटर पर इस्तेमाल किया गया, मेरे मामले में यह "वेबएप" जनरेटर था। 2) जैसा कि मैंने समझाया है, उतना ही उचित नहीं है, जैसा कि समझाया गया है, मैंने पथ और सामान के साथ गड़बड़ी की जो मैं कर सकता था, अब यह गुजरता है और चलता है लेकिन वास्तव में ऐसा नहीं करता है जैसा कि मैंने समझाया है। – SkullDev