Skip to content

Commit 3916c4a

Browse files
committed
修复路径错误
1 parent c4c445a commit 3916c4a

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function createWindow() {
2626
mainWindow.loadURL('file://' + __dirname + '/app.html');
2727

2828
// Open the DevTools.
29-
// mainWindow.webContents.openDevTools();
29+
mainWindow.webContents.openDevTools();
3030

3131
mainWindow.on('close', function (event) {
3232
if(process.platform !== 'win32' && !willClose){

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@
4141
"browser-sync": "^2.11.1",
4242
"crypto-md5": "^1.0.0",
4343
"del": "^2.2.0",
44-
"electron-prebuilt": "^0.37.8",
4544
"extract-zip": "^1.5.0",
46-
"gulp": "^3.9.1",
45+
"gulp": "git://github.com/gulpjs/gulp#4.0",
4746
"gulp-cssnano": "^2.1.1",
4847
"gulp-ejs": "^2.1.1",
4948
"gulp-ftp": "^1.1.0",

src/_tasks/dev.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ function watch(cb) {
165165

166166
function watchHandler(type, file) {
167167

168-
if(typeof file !== 'string'){
169-
file = file.path;
170-
}
171-
172168
let target = file.split('src')[1].match(/[\/\\](\w+)[\/\\]/);
173169

174170
if (target.length && target[1]) {
@@ -178,7 +174,7 @@ function watchHandler(type, file) {
178174
switch (target) {
179175
case 'img':
180176
if (type === 'removed') {
181-
let tmp = file.replace('src/', 'dev/');
177+
let tmp = file.replace(/src/, 'dev');
182178
del([tmp], {force: true}).then(function () {
183179
reloadHandler();
184180
});
@@ -189,7 +185,7 @@ function watchHandler(type, file) {
189185

190186
case 'slice':
191187
if (type === 'removed') {
192-
var tmp = file.replace('src/', 'dev/');
188+
var tmp = file.replace(/src/, 'dev');
193189
del([tmp], {force: true});
194190
} else {
195191
copyHandler('slice', file);
@@ -198,7 +194,7 @@ function watchHandler(type, file) {
198194

199195
case 'js':
200196
if (type === 'removed') {
201-
var tmp = file.replace('src/', 'dev/');
197+
var tmp = file.replace(/src/, 'dev');
202198
del([tmp], {force: true});
203199
} else {
204200
copyHandler('js', file);
@@ -207,7 +203,7 @@ function watchHandler(type, file) {
207203

208204
case 'media':
209205
if (type === 'removed') {
210-
var tmp = file.replace('src/', 'dev/');
206+
var tmp = file.replace(/src/, 'dev');
211207
del([tmp], {force: true});
212208
} else {
213209
copyHandler('media', file);
@@ -217,7 +213,7 @@ function watchHandler(type, file) {
217213
case 'css':
218214

219215
if (type === 'removed') {
220-
var tmp = file.replace('src/', 'dev/').replace('.less', '.css');
216+
var tmp = file.replace(/src/, 'dev').replace('.less', '.css');
221217
del([tmp], {force: true});
222218
} else {
223219
compileLess();
@@ -227,7 +223,8 @@ function watchHandler(type, file) {
227223

228224
case 'html':
229225
if (type === 'removed') {
230-
var tmp = file.replace('src/', 'dev/');
226+
var tmp = file.replace(/src/, 'dev');
227+
console.log(tmp);
231228
del([tmp], {force: true}).then(function () {
232229
});
233230
} else {

src/_tasks/dist.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function dist(projectPath, log, callback) {
8181
dir: path.join(projectPath, './tmp'),
8282
dirAll: path.join(projectPath, './tmp/**/*'),
8383
css: path.join(projectPath, './tmp/css'),
84-
cssAll: path.join(projectPath, './tmp/style-*.css'),
84+
cssAll: path.join(projectPath, './tmp/css/style-*.css'),
8585
img: path.join(projectPath, './tmp/img'),
8686
html: path.join(projectPath, './tmp/html'),
8787
sprite: path.join(projectPath, './tmp/sprite'),
@@ -127,6 +127,7 @@ function dist(projectPath, log, callback) {
127127
gulp.src(paths.src.less)
128128
.pipe(less())
129129
.pipe(lazyImageCSS({imagePath: lazyDir}))
130+
.pipe(gulp.dest(paths.tmp.css))
130131
.on('data', function(){})
131132
.on('end', function () {
132133
console.log('compileLess success.');

0 commit comments

Comments
 (0)