我无法弄清楚如何显示Electron的打开文件对话框。
当我使用提供的示例时,我收到错误:
Error: Cannot find module 'electron' from '/Users/michaelcalkins/Code/codesketcher/assets/js'
https://github.com/atom/electron/blob/master/docs/api/dialog.md
我使用browserify构建应用程序,我尝试的任何内容都会产生错误。
Gulpfile内容:
var elixir = require('laravel-elixir')
elixir.config.assetsPath = 'assets'
elixir(function(mix) {
mix.sass('app.scss', 'dist/css')
.browserify('app.js', 'dist/js')
})
答案 0 :(得分:0)
事实证明,与gulp一起转化的方式很重要。无论出于何种原因,Laravel Elixir打破了构建。使用不同的gulp文件,我能够使它完美运行。
var gulp = require('gulp'),
babel = require('gulp-babel'),
run = require('gulp-run'),
rename = require('gulp-rename'),
watch = require('gulp-watch'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
del = require('del')
gulp.task('scripts', function() {
return gulp.src('./assets/js/app.js')
.pipe(babel())
.pipe(rename('index.js'))
.pipe(gulp.dest('./'))
})
gulp.task('styles', function() {
return sass('assets/sass/app.scss', { style: 'expanded' })
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('dist/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(gulp.dest('dist/css'))
.pipe(notify({ message: 'Styles task complete' }))
})
gulp.task('run', ['default'], function() {
return run('electron .').exec()
})
gulp.task('watch', ['scripts', 'styles'], function (cb) {
watch('assets/js/**/*.js', function () {
gulp.run('scripts')
})
watch('assets/scss/**/*.scss', function () {
gulp.run('styles')
})
})
gulp.task('default', ['scripts', 'styles'])