Skip to content

Add supporting .json files #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getFilesFromDisk(subdir) {
var filesOnDisk = [];

// Only iterate through supported .js, .gs and .html files in dir
dir.readFiles(subdir, { match: /.js$|.gs$|.html$/ },
dir.readFiles(subdir, { match: /.js$|.gs$|.json$|.html$/ },
// Invoke this callback on each file
function(err, content, filename, next) {
if (err) return reject(err);
Expand Down Expand Up @@ -50,12 +50,14 @@ function hasFileOnDisk(filesOnDisk, file) {
function getFileType(file) {
if (file.ext === '.js') return 'server_js';
if (file.ext === '.gs') return 'server_js';
if (file.ext === '.json') return 'json';
if (file.ext === '.html') return 'html';
throw new Error('Unsupported file type found. Google Apps Script only allows .js and .html');
}

function getFileExtension(file) {
if (file.type === 'server_js') return '.js';
if (file.type === 'json') return '.json';
if (file.type === 'html') return '.html';
throw new Error('Unsupported file type found');
}
Expand Down