Electron-beam exposure of optical gratings