Browse Source

altera configurações para pasta público de tema ser importada no build

pull/2485/head
Leandro Roberto 7 years ago
parent
commit
09ed17ced8
  1. 9
      sapl-frontend/package.json
  2. 2
      sapl-frontend/src/apps/compilacao/main.js
  3. 3
      sapl-frontend/src/global/functions.js
  4. 8
      sapl-frontend/src/global/main.js
  5. 72
      sapl-frontend/vue.config.js
  6. 10
      sapl/settings.py

9
sapl-frontend/package.json

@ -34,10 +34,6 @@
"@vue/cli-service": "^3.3.0",
"babel-eslint": "^10.0.1",
"css-loader": "^2.1.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.21",
"eslint": "^5.12.0",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
@ -46,6 +42,9 @@
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.1.0"
"eslint-plugin-vue": "^5.1.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.21"
}
}

2
sapl-frontend/src/apps/compilacao/main.js

@ -2,8 +2,6 @@
import './scss/compilacao.scss'
import 'bootstrap'
import compilacao from './js/old/compilacao'
import compilacaoView from './js/old/compilacao_view'
import compilacaoNotas from './js/old/compilacao_notas'

3
sapl-frontend/src/global/functions.js

@ -1,3 +1,6 @@
window.jQuery = jQuery
window.$ = jQuery
window.getCookie = function (name) {
var cookieValue = null
if (document.cookie && document.cookie !== '') {

8
sapl-frontend/src/global/main.js

@ -4,16 +4,14 @@ import 'jquery-mask-plugin'
import 'webpack-jquery-ui/dialog'
import 'webpack-jquery-ui/sortable'
import 'bootstrap'
import './functions'
import 'bootstrap'
import './image_cropping'
require('imports-loader?window.jQuery=jquery!./jquery.runner.js')
window.jQuery = jQuery
window.$ = jQuery
// require(THEME_CUSTOM + '/src/assets/img/authenticated.png')
window.autorModal()
window.refreshMask()

72
sapl-frontend/vue.config.js

@ -8,9 +8,13 @@ dotenv.config({ path: '../sapl/.env' })
var THEME_CUSTOM = process.env.THEME_CUSTOM === undefined ? 'sapl-oficial-theme' : process.env.THEME_CUSTOM
module.exports = {
publicPath: 'http://localhost:8080/',
publicPath: process.env.NODE_ENV === 'production' ? '/static/' : 'http://localhost:8080/',
outputDir: './dist/',
configureWebpack: {
devtool: 'cheap-module-eval-source-map',
},
chainWebpack: config => {
config.optimization
.splitChunks(false)
@ -19,8 +23,6 @@ module.exports = {
.plugin('BundleTracker')
.use(BundleTracker, [{ filename: './webpack-stats.json' }])
config.devtool = 'source-map'
config.resolve.alias
.set('__STATIC__', 'static')
@ -36,11 +38,50 @@ module.exports = {
.contentBase([
path.join(__dirname, 'public'),
path.join(__dirname, 'src', 'assets'),
path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public')
//path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public'),
//path.join(__dirname, 'node_modules', THEME_CUSTOM, 'src', 'assets')
])
config.entryPoints.delete('app')
config
.plugin('copy')
.tap(([options]) => {
options.push(
{
from: path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public'),
to: path.join(__dirname, 'dist'),
toType: 'dir',
ignore: [
'.DS_Store'
]
})
return [options]
})
/*
new CopyWebpackPlugin(
[
{
from: '/home/leandro/desenvolvimento/envs/sapl/sapl-frontend/public',
to: '/home/leandro/desenvolvimento/envs/sapl/sapl-frontend/dist',
toType: 'dir',
ignore: [
'.DS_Store'
]
}
]
),
config
.module
.rule('images')
.use('url-loader')
.loader('url-loader')
.tap(options => {
options.fallback.options.name = (process.env.NODE_ENV === 'production'
? '/static/'
: '') + options.fallback.options.name
return options
}) */
config
.plugin('provide')
.use(require('webpack/lib/ProvidePlugin'), [{
@ -50,25 +91,28 @@ module.exports = {
jQuery: 'jquery',
_: 'lodash'
}])
config.entryPoints.delete('app')
config.entry(THEME_CUSTOM)
config
.entry(THEME_CUSTOM)
.add('./src/theme-dev/main.js')
// .add(THEME_CUSTOM + '/src/main.js')
.end()
config.entry('global')
config
.entry('global')
.add('./src/global/main.js')
.end()
config.entry('compilacao')
.add('./src/apps/compilacao/main.js')
.end()
.add('./src/apps/compilacao/main.js')
.end()
/* config
.plugin('theme')
.use(webpack.DefinePlugin, [{
THEME_CUSTOM: JSON.stringify(THEME_CUSTOM)
}])
.end() */
.plugin('theme')
.use(webpack.DefinePlugin, [{
THEME_CUSTOM: JSON.stringify(THEME_CUSTOM)
}])
.end() */
}
}

10
sapl/settings.py

@ -264,32 +264,26 @@ LOCALE_PATHS = (
'locale',
)
WEBPACK_LOADER = {
'DEFAULT': {
'CACHE': not DEBUG,
'BUNDLE_DIR_NAME': 'bundle/dist/',
'BUNDLE_DIR_NAME': 'dist/',
'STATS_FILE': FRONTEND_DIR.child('webpack-stats.json'),
'POLL_INTERVAL': 0.1,
'TIMEOUT': None,
'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
}
}
THEME_CUSTOM = config('THEME_CUSTOM', default='sapl-oficial-theme')
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR.child("collected_static")
# STATICFILES_DIRS = (BASE_DIR.child("static"),)
STATICFILES_DIRS = (
# BASE_DIR.child("static"),
FRONTEND_DIR.child('dist'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',

Loading…
Cancel
Save