Skip to content

Commit

Permalink
Use web view for Chrome app's window
Browse files Browse the repository at this point in the history
  • Loading branch information
zalmoxisus committed Jan 8, 2016
1 parent 4569d86 commit 7a52331
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions gulp/tasks/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import rename from 'gulp-rename';

const copy = (dest, manifest) => () => {
if (manifest) {
gulp.src(`./src/browser/${manifest}`)
gulp.src(`./src/${manifest}`)
.pipe(rename('manifest.json'))
.pipe(gulp.dest(dest));
}
gulp.src('./src/assets/**/*').pipe(gulp.dest(dest));
};

gulp.task('copy:dev', copy('./dev', 'extension/manifest.dev.json'));
gulp.task('copy:build:extension', copy('./build/extension', 'extension/manifest.prod.json'));
gulp.task('copy:dev', copy('./dev', 'browser/extension/manifest.dev.json'));
gulp.task('copy:build:extension', copy('./build/extension', 'browser/extension/manifest.prod.json'));
gulp.task('copy:build:app', copy('./build/app', 'chromeApp/manifest.json'));
gulp.task('copy:build:web', copy('./build/web'));

Expand Down
19 changes: 12 additions & 7 deletions gulp/tasks/views.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import gulp from 'gulp';
import jade from 'gulp-jade';

const compile = (dest, p = 0, env = 'prod') => () => {
const paths = ['./src/browser/views/*.jade', './src/views/*.jade'];

const compile = (dest, path, env = 'prod') => () => {
const paths = ['./src/browser/views/*.jade', './src/views/*.jade'];
gulp.src(p === 'all' ? paths : paths[p])
gulp.src(path)
.pipe(jade({
locals: { env }
}))
.pipe(gulp.dest(dest));
};

gulp.task('views:dev', compile('./dev', 'all', 'dev'));
gulp.task('views:build:extension', compile('./build/extension'));
gulp.task('views:build:app', compile('./build/app'));
gulp.task('views:build:electron', compile('./build/electron', 1));
gulp.task('views:build:web', compile('./build/web', 1));
gulp.task('views:dev', compile('./dev', paths, 'dev'));
gulp.task('views:build:extension', compile('./build/extension', paths[0]));
gulp.task('views:build:app', () => {
compile('./build/app', paths[1])();
compile('./build/app', './src/browser/views/background.jade')();
});
gulp.task('views:build:electron', compile('./build/electron', paths[1]));
gulp.task('views:build:web', compile('./build/web', paths[1]));
15 changes: 5 additions & 10 deletions src/chromeApp/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import configureStore from '../../app/store/configureStore';

configureStore(store => {
window.store = store;
chrome.app.runtime.onLaunched.addListener(function () {
chrome.app.window.create('window.html', {
'state': 'maximized'
// More parameters: https://developer.chrome.com/apps/app_window#CreateWindowOptions
});
chrome.app.runtime.onLaunched.addListener(function () {
chrome.app.window.create('index.html', {
'state': 'normal'
// More parameters: https://developer.chrome.com/apps/app_window#CreateWindowOptions
});
}, true);
});
4 changes: 2 additions & 2 deletions webpack/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import baseConfig from './base.config';

export default baseConfig({
input: {
background: [path.join(__dirname, '../src/browser/chromeApp/index')],
window: [path.join(__dirname, '../src/browser/window/index')]
background: [path.join(__dirname, '../src/chromeApp/index')],
app: [path.join(__dirname, '../src/web/index')]
},
output: {
path: path.join(__dirname, '../build/app/js')
Expand Down

0 comments on commit 7a52331

Please sign in to comment.